-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support types from external packages (#33)
- Loading branch information
Showing
9 changed files
with
188 additions
and
73 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
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
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
36 changes: 36 additions & 0 deletions
36
pkg/analyzer/testdata/src/examples/positive_external_types.go
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,36 @@ | ||
package examples | ||
|
||
import ( | ||
"go/token" | ||
"io" | ||
"net/http" | ||
"os" | ||
|
||
"somepkg" | ||
) | ||
|
||
func structPtrTypeExtPkg() (*os.File, error) { | ||
return nil, nil // want "return both the `nil` error and invalid value: use a sentinel error instead" | ||
} | ||
|
||
func primitivePtrTypeExtPkg() (*token.Token, error) { | ||
return nil, nil // want "return both the `nil` error and invalid value: use a sentinel error instead" | ||
} | ||
|
||
func channelTypeExtPkg() (somepkg.ChannelType, error) { | ||
return nil, nil // want "return both the `nil` error and invalid value: use a sentinel error instead" | ||
} | ||
|
||
func funcTypeExtPkg() (http.HandlerFunc, error) { | ||
return nil, nil // want "return both the `nil` error and invalid value: use a sentinel error instead" | ||
} | ||
|
||
func ifaceTypeExtPkg() (io.Closer, error) { | ||
return nil, nil // want "return both the `nil` error and invalid value: use a sentinel error instead" | ||
} | ||
|
||
type closerAlias = io.Closer | ||
|
||
func ifaceTypeAliasedExtPkg() (closerAlias, error) { | ||
return nil, nil // want "return both the `nil` error and invalid value: use a sentinel error instead" | ||
} |
File renamed without changes.
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,3 @@ | ||
package somepkg | ||
|
||
type ChannelType chan int |
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,12 @@ | ||
package strange | ||
|
||
type error = *int | ||
|
||
func myOwnError() (*int, error) { | ||
return nil, nil | ||
} | ||
|
||
func myOwnNil() (*int, error) { | ||
nil := new(int) | ||
return nil, nil | ||
} |