Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single Go Mod #366

Merged
merged 2 commits into from
Apr 19, 2023
Merged

Single Go Mod #366

merged 2 commits into from
Apr 19, 2023

Conversation

cameron-dunn-sublime
Copy link
Contributor

Describe the change
Follow up from this comment thread.

This change moves this repo to a single go.mod/go.sum file (instead of one per cmd target). This means that when a main.go file depends on something else in the repo, for example the structs package, it will depend on that package locally. Previously it depended on these resources as if they were an external library, which made updates awkward.

I've included two commits here. The first shows what everything looks like if the go.* files are in src/go. Unfortunately that causes some slight inconveniences . go build won't run as go build github.com/target/strelka/src/go/cmd/strelka-oneshot (error: go.mod file not found in current directory or any parent directory). So that means you need to cd into src/go or use -C to set the directory. Running the build in src/go/cmd/strelka-oneshot still works though. Anyways, go build dumps the built binary in its working directory so that may just change some of the processes in docs.

The second commit shows the most common pattern -- go.* files in the root of the repo. This is the most convenient except for the slight modification to the Dockerfiles required to separately copy the go.* files.

I hope that all makes some sense!

Describe testing procedures

docker-compose -f build/docker-compose.yaml build && \
docker-compose -f build/docker-compose.yaml up -d

I can do some more thorough testing, but I believe just building validates everything that changed.

Sample output
N/A

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of and tested my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

@phutelmyer phutelmyer added the enhancement New feature or request label Apr 18, 2023
@phutelmyer
Copy link
Contributor

Tested - this works as advertised.
Thank you for this. Much cleaner. :)

@phutelmyer phutelmyer merged commit 4b991d4 into target:master Apr 19, 2023
@cameron-dunn-sublime cameron-dunn-sublime deleted the cd.rework-mod branch April 19, 2023 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants