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

Add support to go run to use Buildtags #1857

Closed
pjfoley opened this issue Jun 10, 2018 · 1 comment
Closed

Add support to go run to use Buildtags #1857

pjfoley opened this issue Jun 10, 2018 · 1 comment

Comments

@pjfoley
Copy link

pjfoley commented Jun 10, 2018

Files used

main.go

package main

import "fmt"
import "${PATHTOREPOSITORY}/config

func main() {
    if config.PrintToConsole {
        fmt.Println("Developing application ....")
    } else {
        fmt.Println("In Production ....")
    }
}

config/constants_coding.go

// +build coding

package config

const PrintToConsole = true

config/constants_production.go

// +build !coding

package config

const PrintToConsole = false

What did you do? (required. The issue will be closed when not provided.)

Within the main.go file I set the Build Tag and then issued a go run from within VIM.

:GoBuildTags coding
:GoRun

What did you expect to happen?

I expected it to print:

Developing application ....

Press ENTER or type command to continue

What happened instead?

In Production ....

Press ENTER or type command to continue

Configuration (MUST fill this out):

  • vim-go version:

I did a :PlugUpdate
Doing a git log in the vim-go directory the commit checked out is f140383

  • vimrc you used to reproduce (use a minimal vimrc with other plugins disabled; do not link to a 2,000 line vimrc):

Base vimrc with plug and vim-go installed.

  • Vim version (first three lines from :version):
    :version
    VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Sep 30 2017 18:21:38)
    Included patches: 1-197, 322, 377-378, 550, 703, 706-707
    Modified by [email protected]
    Compiled by [email protected]

  • Go version (go version):
    go version go1.10.2 linux/amd64

  • Go environment (go env):

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/jsmith/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/jsmith/go"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
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-build253018108=/tmp/go-build -gno-record-gcc-switches"

@pjfoley
Copy link
Author

pjfoley commented Jun 10, 2018

I should add that this commit #1705 seems to have added the capability to most of the other Go commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant