-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from jmattheis/panic-interface-type
- Loading branch information
Showing
7 changed files
with
203 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,7 +86,7 @@ use reflection. | |
1. Run `goverter`: | ||
|
||
```bash | ||
$ go run github.com/jmattheis/goverter/cmd/[email protected].2 ./ | ||
$ go run github.com/jmattheis/goverter/cmd/[email protected].3 ./ | ||
``` | ||
|
||
See [Installation](https://goverter.jmattheis.de/#/install) for more information. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
input: | ||
input.go: | | ||
package structs | ||
import "io" | ||
// goverter:converter | ||
// goverter:extend ConvertInterface | ||
type Converter interface { | ||
Convert(source map[string]interface { | ||
io.Reader | ||
Test() bool | ||
}) map[string]interface { | ||
io.Writer | ||
Test() bool | ||
} | ||
} | ||
func ConvertInterface(x interface { | ||
io.Reader | ||
Test() bool | ||
}) interface { | ||
io.Writer | ||
Test() bool | ||
} { | ||
return nil | ||
} | ||
success: | | ||
// Code generated by github.com/jmattheis/goverter, DO NOT EDIT. | ||
package generated | ||
import ( | ||
execution "github.com/jmattheis/goverter/execution" | ||
"io" | ||
) | ||
type ConverterImpl struct{} | ||
func (c *ConverterImpl) Convert(source map[string]interface { | ||
io.Reader | ||
Test() bool | ||
}) map[string]interface { | ||
io.Writer | ||
Test() bool | ||
} { | ||
mapStringUnknown := make(map[string]interface { | ||
io.Writer | ||
Test() bool | ||
}, len(source)) | ||
for key, value := range source { | ||
mapStringUnknown[key] = execution.ConvertInterface(value) | ||
} | ||
return mapStringUnknown | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
input: | ||
input.go: | | ||
package structs | ||
import "io" | ||
// goverter:converter | ||
// goverter:extend ConvertInterface | ||
type Converter interface { | ||
Convert(source map[string]interface{ io.Reader }) map[string]interface{ io.Writer } | ||
} | ||
func ConvertInterface(x interface{io.Reader}) interface{io.Writer} { | ||
return nil | ||
} | ||
success: | | ||
// Code generated by github.com/jmattheis/goverter, DO NOT EDIT. | ||
package generated | ||
import ( | ||
execution "github.com/jmattheis/goverter/execution" | ||
"io" | ||
) | ||
type ConverterImpl struct{} | ||
func (c *ConverterImpl) Convert(source map[string]interface { | ||
io.Reader | ||
}) map[string]interface { | ||
io.Writer | ||
} { | ||
mapStringUnknown := make(map[string]interface { | ||
io.Writer | ||
}, len(source)) | ||
for key, value := range source { | ||
mapStringUnknown[key] = execution.ConvertInterface(value) | ||
} | ||
return mapStringUnknown | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
input: | ||
input.go: | | ||
package structs | ||
// goverter:converter | ||
// goverter:extend ConvertInterface | ||
type Converter interface { | ||
Convert(source map[string]interface{}) map[string]interface{} | ||
} | ||
func ConvertInterface(x interface{}) interface{} { | ||
return nil | ||
} | ||
success: | | ||
// Code generated by github.com/jmattheis/goverter, DO NOT EDIT. | ||
package generated | ||
import execution "github.com/jmattheis/goverter/execution" | ||
type ConverterImpl struct{} | ||
func (c *ConverterImpl) Convert(source map[string]interface{}) map[string]interface{} { | ||
mapStringUnknown := make(map[string]interface{}, len(source)) | ||
for key, value := range source { | ||
mapStringUnknown[key] = execution.ConvertInterface(value) | ||
} | ||
return mapStringUnknown | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
input: | ||
input.go: | | ||
package structs | ||
// goverter:converter | ||
// goverter:extend ConvertInterface | ||
type Converter interface { | ||
Convert(source map[string]interface { | ||
Test(x bool) (l string, err error) | ||
}) map[string]interface{ Test2() } | ||
} | ||
func ConvertInterface(x interface { | ||
Test(x bool) (l string, err error) | ||
}) interface{ Test2() } { | ||
return nil | ||
} | ||
success: | | ||
// Code generated by github.com/jmattheis/goverter, DO NOT EDIT. | ||
package generated | ||
import execution "github.com/jmattheis/goverter/execution" | ||
type ConverterImpl struct{} | ||
func (c *ConverterImpl) Convert(source map[string]interface { | ||
Test(bool) (string, error) | ||
}) map[string]interface { | ||
Test2() | ||
} { | ||
mapStringUnknown := make(map[string]interface { | ||
Test2() | ||
}, len(source)) | ||
for key, value := range source { | ||
mapStringUnknown[key] = execution.ConvertInterface(value) | ||
} | ||
return mapStringUnknown | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters