diff --git a/README.md b/README.md new file mode 100644 index 0000000..2fe2eb3 --- /dev/null +++ b/README.md @@ -0,0 +1,13 @@ +# gobug25065 +A repository to reproduce https://github.com/golang/go/issues/25065 + +# Usage +Make sure `$GOPATH` is set properly. Then, run the following commands. + +```shell +go get -d github.com/yunabe/gobug25065 +$(go env GOPATH)/src/github.com/yunabe/gobug25065/run.sh +``` + +# Note +The error is gone if we remove `fmt.Println((*myType).A)` from `src.go`. diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..4169deb --- /dev/null +++ b/run.sh @@ -0,0 +1,16 @@ +pkgdir=$(go env GOPATH)/src/github.com/yunabe/gobug25065/pkg +rm -rf $pkgdir + +echo '## Building libstd.so ##' +go install -buildmode=shared -pkgdir $pkgdir std +echo '## Building gobug25065 ##' +go install -v -x -buildmode=shared -linkshared -pkgdir $pkgdir github.com/yunabe/gobug25065 + +if [ $? -eq 0 ]; then + echo '## Show stats ##' + ls -lah $pkgdir/*.so + ldd $pkgdir/*.so +else + echo FAIL +fi +rm -rf $pkgdir diff --git a/src.go b/src.go new file mode 100644 index 0000000..ef976d1 --- /dev/null +++ b/src.go @@ -0,0 +1,18 @@ +package gobug25065 + +import ( + "fmt" +) + +type myType struct {} + +func (m myType) A() {} +func (p *myType) B() {} + +func Fn() { + p := &myType{} + (*myType).A(p) // OK + fmt.Println((*myType).A) // NG + (*myType).B(p) // OK + fmt.Println((*myType).B) // OK +}