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

doc: GOFLAGS environment variable not in 1.11 release notes #27282

Closed
andybons opened this issue Aug 27, 2018 · 7 comments
Closed

doc: GOFLAGS environment variable not in 1.11 release notes #27282

andybons opened this issue Aug 27, 2018 · 7 comments
Labels
Documentation Issues describing a change to documentation. FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@andybons
Copy link
Member

Commit message introducing it:

    cmd/go: add $GOFLAGS environment variable
    
    People sometimes want to turn on a particular go command flag by default.
    In Go 1.11 we have at least two different cases where users may need this.
    
    1. Linking can be noticeably slower on underpowered systems
    due to DWARF, and users may want to set -ldflags=-w by default.
    
    2. For modules, some users or CI systems will want vendoring always,
    so they want -getmode=vendor (soon to be -mod=vendor) by default.
    
    This CL generalizes the problem to “set default flags for the go command.”
    
    $GOFLAGS can be a space-separated list of flag settings, but each
    space-separated entry in the list must be a standalone flag.
    That is, you must do 'GOFLAGS=-ldflags=-w' not 'GOFLAGS=-ldflags -w'.
    The latter would mean to pass -w to go commands that understand it
    (if any do; if not, it's an error to mention it).
    
    For #26074.
    For #26318.
    Fixes #26585.
    
    Change-Id: I428f79c1fbfb9e41e54d199c68746405aed2319c
    Reviewed-on: https://go-review.googlesource.com/126656
    Run-TryBot: Russ Cox <rsc@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: Rob Pike <r@golang.org>
@gopherbot gopherbot added the Documentation Issues describing a change to documentation. label Aug 27, 2018
@andybons andybons added this to the Go1.11.1 milestone Aug 27, 2018
@andybons andybons self-assigned this Aug 27, 2018
@n
Copy link

n commented Aug 27, 2018

@andybons Can the documentation also clarify how to assign a space delimited argument list?
GOFLAGS='-ldflags="-w -s"' go build
go: parsing $GOFLAGS: unknown flag -s"

@thepudds
Copy link
Contributor

Setting aside the release notes for a moment, there is basic documentation here:

https://tip.golang.org/cmd/go/#hdr-Environment_variables

@agnivade
Copy link
Contributor

@n -

A space-separated list of -flag=value settings

So - GOFLAGS="-ldflags=-w -ldflags=-s"

@FiloSottile FiloSottile added the NeedsFix The path to resolution is known, but the work has not been done. label Aug 30, 2018
@FiloSottile FiloSottile modified the milestones: Go1.11.1, Go1.12 Aug 30, 2018
@FiloSottile
Copy link
Contributor

@gopherbot please file this for backport against 1.11, so the release notes will get updated.

@andybons please make a cherry-pick CL once your change is merged in master.

@gopherbot
Copy link
Contributor

Backport issue(s) opened: #27387 (for 1.11).

Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases.

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/135035 mentions this issue: doc/go1.11: mention new GOFLAGS environment variable

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/135496 mentions this issue: [release-branch.go1.11] doc/go1.11, cmd/go: elaborate on new GOFLAGS environment variable

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation Issues describing a change to documentation. FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

7 participants