Open
Conversation
With go, we can create static binaries easily.
We can even create cross-plaform binaries easily.
Meaning, we can make using scrapyard really easy:
acquire the binary and run it.
This isn't a direct copy, some changes happened while implementing:
* `store` accepts exactly one `key`.
We were only using the first key.
Also, it's unclear what we'd do with the other keys.
* `search` is the only commands that accepts multiple `keys`
It's the only command that was using multiple keys.
* `junk` no longer accepts `paths`.
It might be possible to junk individual paths in a tarball.
That might be the intent of accepting multiple paths.
* `crush` no longer accepts `keys` or `paths`.
We were crushing the yard no matter what keys or paths were given.
* There's only support for the file-based yard.
Implementing the S3 stuff seems doable,
but wanted to take it one step at a time.
And this was a pretty big step.
The code isn't the best, I don't know go well enough to write nice code.
But, it seems to have the equivalent behavior as the Ruby version.
It should retain the same behavior with no argument. But we can also say `./test.sh 'go run cmd/scrapyard/main.go'` and it will run the interpreted go program. Or, we can build the binary and run that. Either way, it allows us to test the go version.
Owner
|
Hmm, not very familiar with go tooling but had some trouble here. go get in the root didn't work at all, but it did if I I suspect I'm just not setting GOROOT or GOPATH somehow but not sure? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Here's that stab I took at writing a go version.
You can run the test file with something like
./test.sh 'go run cmd/scrapyard/main.go'. Might need togo getfirst, I don't really know.This is basically the first real go program I've written, so I'm sure there's a ton of stuff that could be improved. Mostly just followed
gofmt,golint, and whatever else was around. In particular, I've no clue about libraries or structure or anything like that. So, I'm down to change whatever.I tried to stay true to the spirit of the Ruby implementation, but there are some differences (explained in the first commit). As mentioned before, it's only the fileyard version. But we can add the S3 version as well if this seems like a good way to go.
Lemme know if you want this, don't want it, want changes, or whatever else. Happy to follow up with whatever, but also would be totally fine with ditching it if you'd prefer something else.