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

Support workspaces #154

Open
ghost opened this issue Apr 22, 2024 · 0 comments
Open

Support workspaces #154

ghost opened this issue Apr 22, 2024 · 0 comments

Comments

@ghost
Copy link

ghost commented Apr 22, 2024

goimports-reviser can operate only on files in a Go module, but Go workspaces allow one to write files outside of modules and use the dependencies listed in the module.

To reproduce:

mkdir analysis lib

cat >analysis/main.go <<EOF
package main

import "example.com/hello"

func main() {
  println(hello.Hello("you"))
}
EOF

cat  >go.work <<EOF
go 1.22.2

use ./lib
EOF

cat >lib/lib.go <<EOF
package hello

func Hello(who string) string {
  return "Hello " + who + "!"
}
EOF

cat >lib/go.mod <<EOF
module example.com/hello

go 1.22.1
EOF

# To run the main program:
# go run analysis/main.go

# Revise imports:
goimports-reviser analysis/main.go

Result:

open go.mod: no such file or directory

Usage of .../goimports-reviser:
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants