-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
"missing dot in first path element" error for imports from vendor #35048
Comments
The Was the |
Note that module mode does not support relative imports, nor does it use |
We have explicitly set |
Yep, that's the most robust fix. |
I don't think there's anything more to be done here, so closing. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
in linux type: <(prompt)>export GO111MODULE=off and then build & run your project it is related to the change of importing modules in (and after) go version 1.11 |
Running this lead me to a far more intelligible error message:
I was able to fix my path issue, thanks. |
…g Go Modules instead of GOPATH by default * After a system upgrade from `Ubuntu 20.10` to `Ubuntu 21.04`, we noticed an in-house system started failing bats tests that used the `go` utility. An example failure symptom is the following. ```sh $ bats --tap -f TPGC001 bats_tests/test_psql_go_connection.bats 1..1 not ok 1 TPGC001 : fetch column data types . . # > go get: malformed module path "get_column_information": missing dot in first path element ``` * Thanks to golang/go#35048 (comment), I found the issue and workaround. I made a change to do the following before the `go get` that is done in the `run_go()` framework function in `tests/test_helpers.bash.in` and `go` related bats tests started working fine then on. ```sh export GO111MODULE=off ``` * https://dev.to/maelvls/why-is-go111module-everywhere-and-everything-about-go-modules-24k discusses this issue in detail. Pasted below is the relevant text from there. ``` GO111MODULE with Go 1.16 ------------------------ As of Go 1.16, the default behavior is GO111MODULE=on, meaning that if you want to keep using the old GOPATH way, you will have to force Go not to use the Go Modules feature: export GO111MODULE=off ``` * This is exactly what was done at https://gitlab.com/YottaDB/DB/YDBTest/-/merge_requests/1129/diffs too. * We will need to worry about this when Go 1.17 comes out and everything starts only using `Go Modules`. But until then this workaround is good enough.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
upgrade to go1.13 and run
go mod tidy
What did you expect to see?
finish successfully
What did you see instead?
missing dot in first path element
in go1.12, we have generated code(mocks etc.) in
vendor
folder and the code itself imports it by relative path in vendor.here's our code structure
in the code, we import it as
import mock1/...
, and this gives us error of "missing dot in first path element". What is the recommended way in this case?The text was updated successfully, but these errors were encountered: