ramya-rao-a / go-outline

Utility to extract JSON representation of declarations from a Go source file
MIT License
143 stars 57 forks source link

Fix Installation #14

Closed Nexushunter closed 3 years ago

Nexushunter commented 3 years ago

With the move to mod, this repo needs to be updated.

Currently, when using VSCode it fails to install with option -u (The vscode snippet was just a go get -v so 🤷🏻 ).

This adds a mod file to try and correct that.

@ramya-rao-a This should solve #9 but I don't know how to test that (I use Goland for personal projects and collab with VSCode at work).

ramya-rao-a commented 3 years ago

Thanks @Nexushunter

@hyangah Can you please help review this?

hyangah commented 3 years ago

Having go.mod file is a good thing. (With go1.16, the go project won't build without it). But note: even with go.mod in this repo, -u shouldn't be used - -u flag in module mode has special meaning and end users are not supposed to use that flag. The right fix would be to update the README.md file.

go version < 1.12 (do we care?):

go get -u github.com/ramya-rao-a/go-outline

1.12 <= go version < 1.16 (this is what vscode go is doing now for go1.12+), install in Module mode:

cd $(mktemp -d)
go mod init work
go get github.com/ramya-rao-a/go-outline

After go 1.16, use the new go install <tool path>@latest command:

go install github.com/ramya-rao-a/go-outline@latest

I don't think missing go.mod is the cause of #9, and I am not sure if the bug is still reproducible.

ramya-rao-a commented 3 years ago

Thanks @hyangah

Do you recommend merging this PR in its current state?

hyangah commented 3 years ago

This PR itself looks fine except the title - it should be just 'add go.mod'.

ramya-rao-a commented 3 years ago

And we are ok with go.sum being added as well?

hyangah commented 3 years ago

Yes, go.sum needs to be checked in too.

ramya-rao-a commented 3 years ago

Thanks @Nexushunter & @hyangah!