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: install replaces binaries even when unchanged #32338

Open
dan-lind opened this issue May 30, 2019 · 2 comments

Comments

Projects
None yet
3 participants
@dan-lind
Copy link

commented May 30, 2019

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

$ go version
 go1.12.4 linux/amd64

Does this issue reproduce with the latest release?

Yes

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

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/ko1dli/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/ko1dli/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/mnt/c/Users/ko1dli/git/serverless-alias-search/src/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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build698955985=/tmp/go-build -gno-record-gcc-switches"

What did you do?

$ ls -ltr ~/go/bin
total 1438344
-rwxrwxrwx 1 ko1dli ko1dli 16718552 May 30 18:38 alias-search
-rwxrwxrwx 1 ko1dli ko1dli 16120748 May 30 18:38 cognito-post-confirmation
-rwxrwxrwx 1 ko1dli ko1dli 22844935 May 30 18:38 create-account-collect
-rwxrwxrwx 1 ko1dli ko1dli 21897771 May 30 18:38 create-account-sign

$ date
Thu May 30 18:39:22 DST 2019

$ go install -x ./...
WORK=/tmp/go-build166854083

$ ls -ltr ~/go/bin
total 1438344
-rwxrwxrwx 1 ko1dli ko1dli 16718552 May 30 18:40 alias-search
-rwxrwxrwx 1 ko1dli ko1dli 16120748 May 30 18:40 cognito-post-confirmation
-rwxrwxrwx 1 ko1dli ko1dli 22844935 May 30 18:40 create-account-collect
-rwxrwxrwx 1 ko1dli ko1dli 21897771 May 30 18:40 create-account-sign

What did you expect to see?

I expected go install leave the installed files alone, since nothing changed.

What did you see instead?

Every file was recreated with a new date (checked with stat). I'm using WSL on Windows 10, not sure if this might affect this behaviour.

@dan-lind dan-lind changed the title `go install` touches unchanged files go install touches unchanged files May 30, 2019

@dan-lind dan-lind changed the title go install touches unchanged files go install creates new binaries even when unchanged May 30, 2019

@mdempsky mdempsky changed the title go install creates new binaries even when unchanged cmd/go: install replaces binaries even when unchanged May 30, 2019

@mdempsky

This comment has been minimized.

Copy link
Member

commented May 30, 2019

I expected go install leave the installed files alone, since nothing changed.

Can you elaborate on why you expected this? Alternatively, on what problems this is causing for you?

I'm using WSL on Windows 10, not sure if this might affect this behaviour.

For what it's worth, I see the same behavior on Linux, so I don't think this is Windows-specific. I think this is just working as intended at the moment.

@dan-lind

This comment has been minimized.

Copy link
Author

commented May 31, 2019

The problem I'm facing is described in this issue here, related to AWS Cloudformation: aws/aws-cli#3131

I guess you can always argue that this is an issue with AWS Cloudformation, but more generally any implementation that considers the create/change date when determining if a binary has been changed or not would have this issue.

@ALTree ALTree added this to the Go1.14 milestone May 31, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.