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: error importing package with go 1.20. The error does not appear with GO 1.19 #59756

Closed
Luizfpereira opened this issue Apr 21, 2023 · 4 comments
Assignees
Labels
gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@Luizfpereira
Copy link

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

$ go version 1.20.3

Does this issue reproduce with the latest release?

No.

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

go env Output
$ go env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\luizp\AppData\Local\go-build
set GOENV=C:\Users\luizp\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\luizp\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\luizp\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.20
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=0
set GOMOD=C:\Users\luizp\go\src\chatservice\go.mod
set GOWORK=
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set PKG_CONFIG=pkg-config

What did you do?

I tried to import the package "github.com/j178/tiktoken-go" with GO version 1.20. However, even after go mod tidy, it appears in the terminal that GO could find and download the package. As I am using VSCode to test, it still indicates an error saying that it could not import the package and so, I was not able to visualize the methods that I could call from the package.

When I changed GO version to 1.19, the package was imported without problems and VSCode stopped indicating me about the error.

What did you expect to see?

A correct package import.

What did you see instead?

After downloading the package, my editor still indicated an error saying that the package could not be imported. The error was solved only after changing GO versions.

@seankhliao seankhliao changed the title error importing package with go 1.20. The error does not appear with GO 1.19 x/tools/gopls: error importing package with go 1.20. The error does not appear with GO 1.19 Apr 21, 2023
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Apr 21, 2023
@gopherbot gopherbot added this to the Unreleased milestone Apr 21, 2023
@anthdm
Copy link

anthdm commented Apr 26, 2023

Same issue when upgrading from 1.20.2 to 1.20.3

@findleyr
Copy link
Contributor

Thank you for the report. I will investigate.

@findleyr findleyr self-assigned this Apr 26, 2023
@findleyr findleyr modified the milestones: Unreleased, gopls/v0.12.0 Apr 28, 2023
@findleyr findleyr added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label May 3, 2023
@findleyr
Copy link
Contributor

Hi, I could not reproduce this in a new module. Here is my go.mod:

module mod.test

go 1.21

require github.com/j178/tiktoken-go v0.2.1

require github.com/sashabaranov/go-openai v1.5.8 // indirect

And here is my main.go:

package main

import tiktoken_go "github.com/j178/tiktoken-go"

func main() {
	_ = tiktoken_go.CountMessagesTokens
}

Can you share a minimal reproducer?

@findleyr findleyr modified the milestones: gopls/v0.12.0, gopls/v0.13.0 May 22, 2023
@findleyr findleyr added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label May 22, 2023
@gopherbot
Copy link

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@gopherbot gopherbot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants