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

go: Initial commit #9

Merged
merged 1 commit into from
Oct 29, 2024
Merged

go: Initial commit #9

merged 1 commit into from
Oct 29, 2024

Conversation

dcarley
Copy link
Contributor

@dcarley dcarley commented Oct 16, 2024

Common packages for working on Go projects.

I frequently use this from my editor with:

And the following in .envrc:

use flox --remote floxenvs/go

In future the editor dependencies could be broken out to a separate
go-editor or go-lsp environment.

The GOENV hook is copied from our init --auto-setup hook with the
exception of:

  1. Path is modified from goenv to go to match the other example
    environments in this repo
  2. go get . is omitted because it's surprising to fetch dependencies
    when activating an environment and we have plans to remove it from
    the default manifest.

The example module which includes a third-party module to prove that
dependency fetching still works is taken from:

The minimum Go version is currently pinned, both in the manifest.toml
and go.mod, at the latest stable major and minor version. It should
continue to work after a flox upgrade assuming that there are no
breaking changes.

@floxbot floxbot added the team-content Issues to be picked up by @flox/team-content label Oct 16, 2024
Comment on lines 17 to 21
[hook]
on-activate = '''
# Point GOENV to Flox environment cache
export GOENV="$FLOX_ENV_CACHE/goenv"
'''
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From @stealthybox:

also not sure if we should be using the Flox env project cache -- usually Go is pretty good about the global cache for deps/builds/source, but maybe a more pure build could benefit

I'm also not sure about this. Would have to look up the history and confidence-level that we originally added it to the setup hook. We could omit it for now if we're unsure.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be a good idea to include glibc for Linux too so that we don't compile CGO against system libs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's punt on this for the moment. We can revisit later.

Common packages for working on Go projects.

I frequently use this from my editor with:

- https://github.com/flox/flox-direnv

And the following in `.envrc`:

    use flox --remote floxenvs/go

In future the editor dependencies could be broken out to a separate
`go-editor` or `go-lsp` environment.

The `GOENV` hook is copied from our `init --auto-setup` hook with the
exception of:

1. Path is modified from `goenv` to `go` to match the other example
   environments in this repo
2. `go get .` is omitted because it's surprising to fetch dependencies
   when activating an environment and we have plans to remove it from
   the default manifest.

The example module which includes a third-party module to prove that
dependency fetching still works is taken from:

- https://go.dev/blog/using-go-modules

The minimum Go version is currently pinned, both in the `manifest.toml`
and `go.mod`, at the latest stable major and minor version. It should
continue to work after a `flox upgrade` assuming that there are no
breaking changes.
@dcarley
Copy link
Contributor Author

dcarley commented Oct 29, 2024

@garbas I've rebased in the changes that we paired on.

@dcarley dcarley requested a review from garbas October 29, 2024 14:01
@garbas garbas merged commit 6aa3506 into main Oct 29, 2024
3 checks passed
@garbas garbas deleted the dcarley/go branch October 29, 2024 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-content Issues to be picked up by @flox/team-content
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants