Skip to content

Commit

Permalink
fix: prevent concurrent writes in env list command
Browse files Browse the repository at this point in the history
  • Loading branch information
zerok committed Oct 4, 2024
1 parent c5180bf commit ff92951
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/tanka/find.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,13 @@ func findEnvsFromJsonnetFiles(jsonnetFiles []string, opts FindOpts) ([]*v1alpha1

for i := 0; i < opts.Parallelism; i++ {
go func() {
// We need to create a copy of the opts for each goroutine because
// the content may be modified down the line:
jsonnetOpts := opts.JsonnetOpts.Clone()

for jsonnetFile := range jsonnetFilesChan {
// try if this has envs
list, err := List(jsonnetFile, Opts{JsonnetOpts: opts.JsonnetOpts})
list, err := List(jsonnetFile, Opts{JsonnetOpts: jsonnetOpts})
if err != nil &&
// expected when looking for environments
!errors.As(err, &jpath.ErrorNoBase{}) &&
Expand Down

0 comments on commit ff92951

Please sign in to comment.