Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: downloaded module missing a source file #30396

Open
clarkezone opened this issue Feb 26, 2019 · 5 comments

Comments

@clarkezone
Copy link

commented Feb 26, 2019

What version of Go are you using (go version)?

go version go1.12 darwin/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/jamesclarke/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/jamesclarke/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/jamesclarke/Source/Temp/gotest/go.mod"
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/6m/dh9gmlhd00g9qkdsv86pj2dw0000gn/T/go-build486175678=/tmp/go-build -gno-record-gcc-switches -fno-common" 

What did you do?

  1. Create a new project
  2. go mod init gitHub.com/foo/bar
  3. create a hello.go file containing:
package main

import (
        "golang.org/x/crypto/ssh/terminal"
)

func main() {
        _, err := terminal.MakeRaw(0)
        if err != nil {
                log.Fatal(err)
        }
}
  1. go build

What did you expect to see?

Program compiles

What did you see instead?

go build
# golang.org/x/sys/unix
../../../go/pkg/mod/golang.org/x/sys@v0.0.0-20190225065934-cc5685c2db12/unix/fcntl_darwin.go:15:42: undefined: Flock_t              
../../../go/pkg/mod/golang.org/x/sys@v0.0.0-20190225065934-cc5685c2db12/unix/ioctl.go:14:47: undefined: Winsize                     
../../../go/pkg/mod/golang.org/x/sys@v0.0.0-20190225065934-cc5685c2db12/unix/ioctl.go:25:47: undefined: Termios                     
../../../go/pkg/mod/golang.org/x/sys@v0.0.0-20190225065934-cc5685c2db12/unix/sockcmsg_unix.go:50:18: undefined: Cmsghdr             
../../../go/pkg/mod/golang.org/x/sys@v0.0.0-20190225065934-cc5685c2db12/unix/sockcmsg_unix.go:56:9: undefined: Cmsghdr  

Tried go get golang.org/x/sys and build still fails

@bcmills bcmills added the OS-Darwin label Feb 26, 2019
@bcmills

This comment has been minimized.

Copy link
Member

commented Feb 26, 2019

(CC @jayconrod)

All of the missing declarations from that error message come from ztypes_darwin_amd64.go, so it sounds like that file is somehow missing from the extracted module.

Were you by any chance using this version of golang.org/x/sys with a previous version of the Go toolchain, particularly with concurrent invocations of go commands?

If not, please save your main module's go.mod and go.sum files, and save (preferably to a tar or zip archive) the contents of the $GOPATH/pkg/mod/cache/download/golang.org/x/sys/@v and $GOPATH/pkg/mod/golang.org/x/sys@v0.0.0-20190225065934-cc5685c2db12 directory trees (for later investigation), and run go clean -modcache to see if a fresh copy of the module is corrupted in the same way.

@bcmills bcmills added this to the Go1.13 milestone Feb 26, 2019
@bcmills bcmills self-assigned this Feb 26, 2019
@bcmills bcmills changed the title Importing "golang.org/x/crypto/ssh/terminal" results in undefined: Flock_t, Winsize, Termos etc cmd/go: downloaded module missing a source file Feb 26, 2019
@bcmills

This comment has been minimized.

Copy link
Member

commented Feb 26, 2019

I would be especially interested to know:
a. Are the missing files present in the .zip file for that version of the module?
b. Are there any other files present in the .zip file but missing from the unzipped copy of the module?

@clarkezone

This comment has been minimized.

Copy link
Author

commented Feb 27, 2019

I have had previous version's of Go installed but no concurrent invocations of go cmd. The go clean -modcache did fix it, I have the archive if you are interested

@bcmills

This comment has been minimized.

Copy link
Member

commented Mar 7, 2019

Yes, please do attach the archive. (It probably won't have any new clues, but you never know...)

@clarkezone

This comment has been minimized.

Copy link
Author

commented Mar 11, 2019

Here you go

Archive.zip

@andybons andybons modified the milestones: Go1.13, Go1.14 Jul 8, 2019
@rsc rsc modified the milestones: Go1.14, Backlog Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.