go: go/types: type aliases can lead to invalid types
What version of Go are you using (go version
)?
go version go1.10.3 darwin/amd64
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (go env
)?
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/kjk/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/kjk/src/go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.10.3/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.10.3/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/v_/ksw1dqvd59v790zk2wqf_t_80000gn/T/go-build335215962=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
$ git clone https://github.com/kjk/ravendb-go-client.git
$ cd ravendb-go-client.git
$ go vet
./metadata_as_dictionary.go:163:9: cannot use list (variable of type []*MetadataAsDictionary) as []*invalid type value in return statement
./document_query_customization_delegate.go:22:9: cannot use d (variable of type *DocumentQueryCustomizationDelegate) as *invalid type value in return statement
./document_query_customization_delegate.go:27:9: cannot use d (variable of type *DocumentQueryCustomizationDelegate) as *invalid type value in return statement
./document_query_customization_delegate.go:32:9: cannot use d (variable of type *DocumentQueryCustomizationDelegate) as *invalid type value in return statement
./document_query_customization_delegate.go:37:9: cannot use d (variable of type *DocumentQueryCustomizationDelegate) as *invalid type value in return statement
./document_query_customization_delegate.go:42:9: cannot use d (variable of type *DocumentQueryCustomizationDelegate) as *invalid type value in return statement
./document_query_customization_delegate.go:47:9: cannot use d (variable of type *DocumentQueryCustomizationDelegate) as *invalid type value in return statement
./document_query_customization_delegate.go:52:9: cannot use d (variable of type *DocumentQueryCustomizationDelegate) as *invalid type value in return statement
./document_query_customization_delegate.go:57:9: cannot use d (variable of type *DocumentQueryCustomizationDelegate) as *invalid type value in return statement
./document_query_customization_delegate.go:62:9: cannot use d (variable of type *DocumentQueryCustomizationDelegate) as *invalid type value in return statement
./document_query_customization_delegate.go:67:9: cannot use d (variable of type *DocumentQueryCustomizationDelegate) as *invalid type value in return statement
./document_query_customization_delegate.go:72:9: cannot use d (variable of type *DocumentQueryCustomizationDelegate) as *invalid type value in return statement
./document_query_customization_delegate.go:77:9: cannot use d (variable of type *DocumentQueryCustomizationDelegate) as *invalid type value in return statement
./in_memory_document_session_operations.go:175:9: cannot use s._documentStore (variable of type *DocumentStore) as *invalid type value in return statement
./in_memory_document_session_operations.go:185:26: invalid operation: s.getDocumentStore() (value of type *invalid type) has no field or method operations
./abstract_index_creation_task.go:107:9: invalid operation: store (variable of type *invalid type) has no field or method executeIndex
./abstract_index_creation_task.go:123:10: invalid operation: store (variable of type *invalid type) has no field or method getConventions
./abstract_index_creation_task.go:140:14: invalid operation: store (variable of type *invalid type) has no field or method getDatabase
./abstract_index_creation_task.go:142:9: invalid operation: store (variable of type *invalid type) has no field or method maintenance
./document_store.go:267:23: cannot use s (variable of type *DocumentStore) as *invalid type value in argument to task.execute2
./index_creation.go:18:24: cannot use store (variable of type *DocumentStore) as *invalid type value in argument to index.execute2
./attachments_revisions_test.go:326:16: invalid operation: attachment (variable of type *invalid type) has no field or method get
./index_operations_test.go:28:22: cannot use store (variable of type *DocumentStore) as *invalid type value in argument to index.execute
./index_operations_test.go:54:22: cannot use store (variable of type *DocumentStore) as *invalid type value in argument to index.execute
./index_operations_test.go:94:22: cannot use store (variable of type *DocumentStore) as *invalid type value in argument to index.execute
./index_operations_test.go:110:22: cannot use store (variable of type *DocumentStore) as *invalid type value in argument to index.execute
./index_operations_test.go:128:22: cannot use store (variable of type *DocumentStore) as *invalid type value in argument to index.execute
./index_operations_test.go:366:26: cannot use store (variable of type *DocumentStore) as *invalid type value in argument to userIndex.execute
./indexes_from_client_test.go:133:34: cannot use store (variable of type *DocumentStore) as *invalid type value in argument to NewUsers_ByName().execute
vet: typecheck failures
What did you expect to see?
This is a valid program that compiles. go vet
should not complain.
What did you see instead?
go vet
complaints.
Those errors are due to using type Foo = Bar
aliases. Those invalid
types are type aliases.
I know that using type aliases is bad style. Not handling them is still a bug.
I tried to minimize the repro but I failed to create a small example so I’m showing the whole code.
I assume this is a problem with ast
package because other tools break on this codebase as well, like rename symbol
functionality in Visual Studio Code.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 18 (11 by maintainers)
Commits related to this issue
- go/types: remove work-around for issue #26390 This work-around is not needed anymore now that method signatures are type-checked separately from their receiver base types: no artificial cycles are in... — committed to golang/go by griesemer 6 years ago
- Run "go test" with -vet=off Necessary for Go 1.11, see https://github.com/golang/go/issues/26390. — committed to rillig/pkglint by rillig 6 years ago
@kjk Can you please let me know if
go test
works with the flag-vet=off
? Thanks.