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

cmd/go: reject leading dot in module name #66954

Open
Mgrdich opened this issue Apr 21, 2024 · 6 comments
Open

cmd/go: reject leading dot in module name #66954

Mgrdich opened this issue Apr 21, 2024 · 6 comments
Labels
GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.

Comments

@Mgrdich
Copy link

Mgrdich commented Apr 21, 2024

Go version

go1.22.1

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/mgo/Library/Caches/go-build'
GOENV='/Users/mgo/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/mgo/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/mgo/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/Users/mgo/sdk/go1.22.1'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/Users/mgo/sdk/go1.22.1/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.22.1'
GCCGO='gccgo'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/Users/mgo/Documents/testGoApi/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/dn/076kyhqn5knf9lgnb0v9m5980000gn/T/go-build2843189004=/tmp/go-build -gno-record-gcc-switches -fno-common

What did you do?

It is happening when everything is in different folder , and initiated with different packages , that is why i cannot link go.dev/play

but i can link the github repo with a branch that this is happening

https://github.com/Mgrdich/testGoApi/tree/bug/issue/golang

https://github.com/Mgrdich/testGoApi/blob/fd329312a1472c5d3c5269f792a438d999e43829/internal/routes/person.go#L18

https://github.com/Mgrdich/testGoApi/blob/fd329312a1472c5d3c5269f792a438d999e43829/internal/middlewares/movies.go#L28

https://github.com/Mgrdich/testGoApi/blob/fd329312a1472c5d3c5269f792a438d999e43829/internal/middlewares/id_context.go#L14

What did you see happen?

i keep getting this compile time error

panic: R_USEIFACE in .com/internal/middlewares..dict.CheckSlugId[.com/internal/models.Person] references type:.com/internal/util.GetByIDFunc[.com/internal/models.Person] which is not a type or itab

goroutine 1 [running]:
cmd/link/internal/ld.(*deadcodePass).flood(0x14000026910)
	cmd/link/internal/ld/deadcode.go:208 +0xfd4
cmd/link/internal/ld.deadcode(0x1400015e000)
	cmd/link/internal/ld/deadcode.go:433 +0x58
cmd/link/internal/ld.Main(_, {0x10, 0x20, 0x1, 0x1f, 0x1e, 0x7c00000, {0x0, 0x0, 0x0}, ...})
	cmd/link/internal/ld/main.go:353 +0x1180
main.main()
	cmd/link/main.go:72 +0xbd4

as i noticed it is happening something with the folder and package structure

  • i did check for cyclical reference none was there.
  • i am not returning nil references
  • i did raise this issue in golang discord community , they could not figure it out they told me to open an issue.

What did you expect to see?

It return the correct error , with description that module name is invalid.

@seankhliao
Copy link
Member

I don't think that's a valid module name (.com).
Seems to work if you change it to something more normal.

@seankhliao seankhliao changed the title Complie time R_USEIFACE which is not a type or itab issue. cmd/go: reject leading dot in module name Apr 21, 2024
@seankhliao seankhliao added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. GoCommand cmd/go labels Apr 21, 2024
@Mgrdich
Copy link
Author

Mgrdich commented Apr 21, 2024

it works when i change the module name , even though it was working some of the time , but giving issues alot of the other times.

@jfrech
Copy link

jfrech commented Apr 26, 2024

A module path must satisfy the following requirements:

  • The path must consist of one or more path elements separated by slashes (/, U+002F). It must not begin or end with a slash.
  • (...)
  • A path element may not begin or end with a dot (., U+002E).

(...)

Cf. https://go.dev/ref/mod#go-mod-file-ident [2024-04-27]

@Mgrdich
Copy link
Author

Mgrdich commented Apr 29, 2024

yes @jfrech but shouldn't the compiler return the correct error , instead of R_USEIFACE in which is not a type or itab

@jfrech
Copy link

jfrech commented Apr 30, 2024

@Mgrdich I am all for less obtuse failure diagnostics. Yet you wrote "What did you expect to see? ; It should compile the project and produce the executable.", which is behaviour which violates the modules specification.

@Mgrdich
Copy link
Author

Mgrdich commented Apr 30, 2024

@jfrech my bad , I did not know back then it was a module name issue , I will change what do I expect .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants