Skip to content
This repository was archived by the owner on Jan 2, 2024. It is now read-only.

support 'go get', 'go install' #7

Merged
merged 1 commit into from
Oct 14, 2017

Conversation

jpillora
Copy link
Contributor

First off, awesome project 👍

This PR doesn't change any files (except for package import paths), it just restructures the directories to allow for use in a standard Go environment, that is, a global GOPATH. It also makes use of the vendor/ directory to support the included dependencies. Most gophers set their GOPATH in their shell profile, and optionally add $GOPATH/bin to their PATH. This results in:

First time use:

# fetch github.com/twitchyliquid64/subnet into GOPATH/src/github.com/twitchyliquid64/subnet
# and compile the target main package into GOPATH/bin/subnet
$ go get github.com/twitchyliquid64/subnet
# with $GOPATH/bin in our PATH, we can then
$ subnet --help

Development:

$ cd $GOPATH/src/github.com/twitchyliquid64/subnet
# hack away....
$ go install
# compiled to GOPATH/bin/subnet
$ subnet --help

@twitchyliquid64
Copy link
Owner

This is awesome, thanks!

I'm not sure how to use this PR interface or exactly what the etiquette is, but I noticed the commit you have so far deletes a bunch of code (presumably to move it to the correct path) but doesn't add it back anywhere (4 lines added, ~2k lines deleted)? I guess theres another commit coming and I should sit-tight?

@jpillora
Copy link
Contributor Author

jpillora commented Oct 12, 2017

Ah yes, my mistake. The .gitignore had /subnet in there. I should have caught that! Now "Files Changed" tab is mostly: File renamed without changes.. A few notes:

  • github.com/twitchyliquid64/subnet is the main package (when a repo represents a cli program, I make the root dir the main package and I put the library code in a subdir).
  • github.com/twitchyliquid64/subnet/subnet is the library package for programmatic usage.
  • github.com/twitchyliquid64/subnet/vendor is the dependency dir. it is special since Go resolves pkg by first checking ./vendor/<pkg> then checking $GOPATH/src/<pkg>.

(I did a git push --force to keep the history a bit cleaner)

@twitchyliquid64 twitchyliquid64 merged commit 0af6e33 into twitchyliquid64:master Oct 14, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants