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: buildmode is not set in build settings #53856

Closed
capnspacehook opened this issue Jul 13, 2022 · 4 comments
Closed

cmd/go: buildmode is not set in build settings #53856

capnspacehook opened this issue Jul 13, 2022 · 4 comments
Assignees
Labels
FrozenDueToAge GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@capnspacehook
Copy link

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

$ go version 18.4

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
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/capnspacehook/.cache/go-build"
GOENV="/home/capnspacehook/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/capnspacehook/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/capnspacehook/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.18.4"
GCCGO="gccgo"
GOAMD64="v3"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
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-build4110434964=/tmp/go-build -gno-record-gcc-switches"

What did you do?

go build -o hello hello.go
go version -m hello
go build -buildmode pie -o hello-pie hello.go
go version -m hello-pie

hello.go:

package main

import "fmt"

func main() {
        fmt.Println("yo")
}

What did you expect to see?

hello: go1.18.4
        path    command-line-arguments
        build   -compiler=gc
        build   -buildmode=exe
        build   CGO_ENABLED=1
        build   CGO_CFLAGS=
        build   CGO_CPPFLAGS=
        build   CGO_CXXFLAGS=
        build   CGO_LDFLAGS=
        build   GOARCH=amd64
        build   GOOS=linux
        build   GOAMD64=v3

hello-pie: go1.18.4
        path    command-line-arguments
        build   -compiler=gc
        build   -buildmode=pie
        build   CGO_ENABLED=1
        build   CGO_CFLAGS=
        build   CGO_CPPFLAGS=
        build   CGO_CXXFLAGS=
        build   CGO_LDFLAGS=
        build   GOARCH=amd64
        build   GOOS=linux
        build   GOAMD64=v3

What did you see instead?

hello: go1.18.4
        path    command-line-arguments
        build   -compiler=gc
        build   CGO_ENABLED=1
        build   CGO_CFLAGS=
        build   CGO_CPPFLAGS=
        build   CGO_CXXFLAGS=
        build   CGO_LDFLAGS=
        build   GOARCH=amd64
        build   GOOS=linux
        build   GOAMD64=v3

hello-pie: go1.18.4
        path    command-line-arguments
        build   -compiler=gc
        build   CGO_ENABLED=1
        build   CGO_CFLAGS=
        build   CGO_CPPFLAGS=
        build   CGO_CXXFLAGS=
        build   CGO_LDFLAGS=
        build   GOARCH=amd64
        build   GOOS=linux
        build   GOAMD64=v3

I expected to see the -buildmode flag in the build settings. I can see that it is not added here:

appendSetting("-compiler", cfg.BuildContext.Compiler)

@seankhliao seankhliao added NeedsFix The path to resolution is known, but the work has not been done. GoCommand cmd/go labels Jul 13, 2022
@seankhliao
Copy link
Member

cc @bcmills @matloob

@bcmills
Copy link
Contributor

bcmills commented Jul 13, 2022

Good suggestion. Want to send a change to add it? (We can merge it when the window opens for Go 1.20.)

@bcmills bcmills added this to the Go1.20 milestone Jul 13, 2022
@capnspacehook
Copy link
Author

Sure, I'll send a change

@gopherbot
Copy link

Change https://go.dev/cl/420937 mentions this issue: cmd/go: add buildmode info

cuiweixie added a commit to cuiweixie/go that referenced this issue Aug 13, 2022
cuiweixie added a commit to cuiweixie/go that referenced this issue Aug 13, 2022
cuiweixie added a commit to cuiweixie/go that referenced this issue Aug 30, 2022
Fixes golang#53856

Change-Id: Ib533e9fbe063b74c81f6512464a4dac5e2af0ccc
GitHub-Last-Rev: 5df0f63
GitHub-Pull-Request: golang#54218
cuiweixie added a commit to cuiweixie/go that referenced this issue Aug 30, 2022
Fixes golang#53856

Change-Id: Ib533e9fbe063b74c81f6512464a4dac5e2af0ccc
GitHub-Last-Rev: e3a8da5
GitHub-Pull-Request: golang#54218
cuiweixie added a commit to cuiweixie/go that referenced this issue Aug 30, 2022
Fixes golang#53856

Change-Id: Ib533e9fbe063b74c81f6512464a4dac5e2af0ccc
GitHub-Last-Rev: e3a8da5
GitHub-Pull-Request: golang#54218
cuiweixie added a commit to cuiweixie/go that referenced this issue Aug 30, 2022
Fixes golang#53856

Change-Id: Ib533e9fbe063b74c81f6512464a4dac5e2af0ccc
GitHub-Last-Rev: e3a8da5
GitHub-Pull-Request: golang#54218
cuiweixie added a commit to cuiweixie/go that referenced this issue Sep 8, 2022
Fixes golang#53856

Change-Id: Ib533e9fbe063b74c81f6512464a4dac5e2af0ccc
GitHub-Last-Rev: 5df0f63
GitHub-Pull-Request: golang#54218
cuiweixie added a commit to cuiweixie/go that referenced this issue Sep 8, 2022
Fixes golang#53856

Change-Id: Ib533e9fbe063b74c81f6512464a4dac5e2af0ccc
GitHub-Last-Rev: 5df0f63
GitHub-Pull-Request: golang#54218
cuiweixie added a commit to cuiweixie/go that referenced this issue Sep 8, 2022
Fixes golang#53856

Change-Id: Ib533e9fbe063b74c81f6512464a4dac5e2af0ccc
GitHub-Last-Rev: 5df0f63
GitHub-Pull-Request: golang#54218
@golang golang locked and limited conversation to collaborators Sep 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants