Skip to content

Commit

Permalink
cmd/govim: test the setting of GoplsEnv with build tags in GOFLAGS (#595
Browse files Browse the repository at this point in the history
)

We currently support the setting of GOFLAGS with values like
-modefile=go.local.mod. But because of golang.org/issues/29202 have been
unable to supported (in a tested way) the setting of build tags as part
of GOFLAGS.

Add such a test to verify the gopls fix works, but skip for now pending
golang.org/issues/29202.
  • Loading branch information
myitcv committed Feb 11, 2020
1 parent 4f5867f commit a300cd4
Showing 1 changed file with 51 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Test that calling govim#config#Set with a value for GoplsEnv of GOFLAGS
# does the right thing.

[golang.org/issues/29202] skip

# Before setting GOFLAGS with -tags=other
vim ex 'e main.go'
vimexprwait pre.golden getqflist()

# After setting GOFLAGS with -tags=other
vim ex 'call govim#config#Set(\"GoplsEnv\", {\"GOFLAGS\": \"-tags=other\"})'
vimexprwait post.golden getqflist()

# Assert that we have received no error (Type: 1) or warning (Type: 2) log messages
# Disabled pending resolution to https://github.com/golang/go/issues/34103
# errlogmatch -start -count=0 'LogMessage callback: &protocol\.LogMessageParams\{Type:(1|2), Message:".*'

-- go.mod --
module mod.com

go1.12
-- main.go --
package main

func main() {
DoIt()
}
-- other.go --
// +build other

package main

func DoIt() {
}
-- pre.golden --
[
{
"bufnr": 1,
"col": 2,
"lnum": 4,
"module": "",
"nr": 0,
"pattern": "",
"text": "undeclared name: DoIt",
"type": "",
"valid": 1,
"vcol": 0
}
]
-- post.golden --
[]

0 comments on commit a300cd4

Please sign in to comment.