bazel-contrib / rules_go

Go rules for Bazel
Apache License 2.0
1.38k stars 656 forks source link

How to load the .env configuration file and run it in the sandbox #4089

Closed liushuai05 closed 1 month ago

liushuai05 commented 1 month ago

What version of rules_go are you using?

1.22.5

What version of gazelle are you using?

0.37.0

What version of Bazel are you using?

7.3.0

Does this issue reproduce with the latest releases of all the above?

yes

What operating system and processor architecture are you using?

manjaro

Any other potentially useful information about your toolchain?

no

What did you do?

What did you expect to see?

I use the goravel framework. There is an .env file in the WORKSPACE directory corresponding to golang. I want to load this file at runtime, but it doesn't seem to be loaded into the sandbox.

What did you see instead?

INFO: Analyzed target //:goravel (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //:goravel up-to-date:
  bazel-bin/goravel_/goravel
INFO: Elapsed time: 0.132s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Running command line: bazel-bin/goravel_/goravel
Please initialize APP_KEY first.
Create a .env file and run command: go run . artisan key:generate
Or set a system variable: APP_KEY={32-bit number} go run .