Closed kehiy closed 8 months ago
@stv0g I tried to do this, but I got errors because go.mod file (just one main function we can have per main package)
I see. But running a single script should not require a Go module. Can you try it without go.mod?
yes, I will try to run them without go.mod
.
@stv0g
we have this issue:
main redeclared in this block (see details)compiler[DuplicateDecl](https://pkg.go.dev/golang.org/x/tools/internal/typesinternal#DuplicateDecl)
lint_go_mod_version.go(16, 6): main redeclared in this block
lint_filename.go(14, 6): other declaration of main (this error)
@kehiy are you explicitly calling go run lint_go_mod_version.go
?
You can have two files with a main in the same directory.
duboisea@b0f1d8547841:~/foo$ cat a.go
package main
import "fmt"
func main() {
fmt.Println("a")
}
duboisea@b0f1d8547841:~/foo$ go run a.go
a
duboisea@b0f1d8547841:~/foo$ cat b.go
package main
import "fmt"
func main() {
fmt.Println("b")
}
duboisea@b0f1d8547841:~/foo$ go run b.go
b
@Sean-Der the error is from IDE!
when I try to run them just version linter raises errors I will push my changes then you can see
@Sean-Der @stv0g can you have a review?
Yes! I will get this merged today, thanks for working on it :)
@Sean-Der thankssss
Did you check that the function name you changed in 546028e0ff1fdc4cf8262ad85d569bf31c0e9820 is also changed at the call site?
@stv0g the function name is okay now.
guys, can we merge this? or is there any change?
@Sean-Der @stv0g guys can you have a review? if you need I can use gomod package also and push it.
Description
Reference issue
Related #163