-
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Types in the universe scope (like error) don't have a package.
- Loading branch information
Showing
3 changed files
with
70 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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
input: | ||
input.go: | | ||
package universe | ||
// goverter:converter | ||
// goverter:extend Error | ||
type Converter interface { | ||
Error(source *error) *error | ||
} | ||
func Error(value error) error { | ||
return value | ||
} | ||
success: | ||
- generated/generated.go: | | ||
// 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) Error(source *error) *error { | ||
var pError *error | ||
if source != nil { | ||
xerror := execution.Error((*source)) | ||
pError = &xerror | ||
} | ||
return pError | ||
} |
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,32 @@ | ||
input: | ||
input.go: | | ||
package universe | ||
// goverter:converter | ||
type Converter interface { | ||
AToB(A) B | ||
} | ||
type A struct { | ||
Property int | ||
} | ||
type B struct { | ||
Property error | ||
} | ||
error: |- | ||
Error while creating converter method: | ||
func (github.com/jmattheis/goverter/execution.Converter).AToB(github.com/jmattheis/goverter/execution.A) github.com/jmattheis/goverter/execution.B | ||
| github.com/jmattheis/goverter/execution.A | ||
| | ||
| | int | ||
| | | ||
source.Property | ||
target.Property | ||
| | | ||
| | error | ||
| | ||
| github.com/jmattheis/goverter/execution.B | ||
TypeMismatch: Cannot convert int to error |
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