pion / .goassets

Asset files automatically deployed to Go package repositories
https://pion.ly/
MIT License
8 stars 10 forks source link

Add lint go mod golang script #182

Closed kehiy closed 8 months ago

kehiy commented 9 months ago

Description

Reference issue

Related #163

kehiy commented 9 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)

stv0g commented 9 months ago

I see. But running a single script should not require a Go module. Can you try it without go.mod?

kehiy commented 9 months ago

yes, I will try to run them without go.mod.

kehiy commented 9 months ago

@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)
Sean-Der commented 9 months ago

@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
kehiy commented 9 months ago

@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

kehiy commented 9 months ago

@Sean-Der @stv0g can you have a review?

Sean-Der commented 9 months ago

Yes! I will get this merged today, thanks for working on it :)

kehiy commented 9 months ago

@Sean-Der thankssss

stv0g commented 9 months ago

Did you check that the function name you changed in 546028e0ff1fdc4cf8262ad85d569bf31c0e9820 is also changed at the call site?

kehiy commented 9 months ago

@stv0g the function name is okay now.

kehiy commented 9 months ago

guys, can we merge this? or is there any change?

kehiy commented 8 months ago

@Sean-Der @stv0g guys can you have a review? if you need I can use gomod package also and push it.