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

x/tools/gopls: report diagnostics for embed comment embed package imported #43497

Closed
wingyplus opened this issue Jan 4, 2021 · 2 comments
Closed
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.

Comments

@wingyplus
Copy link
Contributor

wingyplus commented Jan 4, 2021

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

$ go version
go version devel +9abbe27710 Mon Dec 21 04:23:39 2020 +0000 darwin/amd64

Does this issue reproduce with the latest release?

Can be reproduce on gopls 0.6.1.

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/thanabodee/Library/Caches/go-build"
GOENV="/Users/thanabodee/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/thanabodee/pkg/mod"
GONOPROXY="/*"
GONOSUMDB="/*"
GOOS="darwin"
GOPATH="/Users/thanabodee"
GOPRIVATE="/*"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/Users/thanabodee/tools/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/thanabodee/tools/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="devel +9abbe27710 Mon Dec 21 04:23:39 2020 +0000"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/x7/tl6gyzn92vzcr35t94xgt6y00000gp/T/go-build2368787650=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Try it with this code:

package main

import (
	"fmt"
)

//go:embed hello.txt
var s string

func main() {
	fmt.Println(s)
}

What did you expect to see?

Diagnostics should report as an error on line 7 (embed comment). Just like compiler report:

$ go run main.go
# github.com/wingyplus/test_embed
./main.go:7:3: //go:embed only allowed in Go files that import "embed"

What did you see instead?

Diagnostics didn't report anything.

@gopherbot gopherbot added the gopls Issues related to the Go language server, gopls. label Jan 4, 2021
@stamblerre stamblerre changed the title gopls: publishDiagnostics didn't get error when have embed comment without import embed package x/tools/gopls: report diagnostics for embed comment embed package imported Jan 5, 2021
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Jan 5, 2021
@gopherbot gopherbot added this to the Unreleased milestone Jan 5, 2021
@stamblerre stamblerre modified the milestones: Unreleased, gopls/vscode-go Jan 5, 2021
@stamblerre stamblerre added this to Needs Triage in vscode-go: gopls by default via automation Jan 5, 2021
@stamblerre
Copy link
Contributor

It looks like this has been rendered obsolete by recent changes, described in #43217.

vscode-go: gopls by default automation moved this from Needs Triage to Done Jan 6, 2021
@wingyplus
Copy link
Contributor Author

Thanks for pointing out. That's sound reasonable.

@stamblerre stamblerre removed this from the gopls/vscode-go milestone Jan 8, 2021
@golang golang locked and limited conversation to collaborators Jan 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
No open projects
Development

No branches or pull requests

3 participants