Skip to content

Commit

Permalink
[direnv] Add basic .envrc.example (#4747)
Browse files Browse the repository at this point in the history
Add a basic .envrc.example that will build the go sdk using the Makefile and
setup the environment to use it so developers who use direnv
can easily "automatically" use the managed go sdk. Update CONTRIBUTING.md to
add a section describing the intended usage of direnv .envrc.example.

Signed-off-by: Zack Train <ztrain@uber.com>
  • Loading branch information
zmt authored Jan 3, 2024
1 parent dedb0c1 commit 990bbc3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .envrc.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
toplevel="$(git rev-parse --show-toplevel)"

# build and use the managed go sdk
unset GOROOT
make -C "$toplevel" go-check
PATH="$(make --no-print-directory -C "$toplevel" go-bin-path)"

# add custom direnv initialization below here
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.build
.cache
.data
.envrc
.glide
.tmp
.DS_Store
Expand Down
10 changes: 10 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,16 @@ implementation can easily serve the needs for an entire suite of tests and
the behavior is in a centralized location when it needs to be updated. Fakes
are also less inclined to be impacted by changes to usage patterns.

## Example [direnv][direnv_link] .envrc

We have committed a basic `.envrc.example`. If you use [direnv][direnv_link],
copy it into `.envrc`, edit as desired, and enable it with `direnv allow`. The
`.envrc` is `.gitignored`. Be aware that [source_env][source_env] is insecure
so keep your customizations in `.envrc`.

[direnv_link]: https://direnv.net/
[source_env]: https://direnv.net/man/direnv-stdlib.1.html#codesourceenv-ltfileordirpathgtcode

## Git hooks

We have checked in a pre-commit hook which enforces `go fmt` styling. Please install it
Expand Down

0 comments on commit 990bbc3

Please sign in to comment.