Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2533 from hashicorp/dev-asset-fix
Browse files Browse the repository at this point in the history
Return instead of panic in code that is only used in dev
  • Loading branch information
izaaklauer authored Oct 21, 2021
2 parents 1a5a01a + a2ce0ca commit 29294eb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .changelog/2533.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
serverinstall/ecs: Fix potential panic in some ECS On-Demand Runner releases
```
11 changes: 8 additions & 3 deletions internal/assets/dev.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
//go:generate go-bindata -dev -pkg assets -o dev_assets.go -tags !assetsembedded ceb

//go:build !assetsembedded
// +build !assetsembedded

package assets

import (
Expand All @@ -10,8 +13,13 @@ import (
var rootDir string

func init() {
// Set a reasonable default in the event we somehow fail to find the root
// directory
rootDir = "./internal/assets"
dir, err := os.Getwd()
if err != nil {
// There is some strange circumstance that would cause this to panic,
// but would only happen in a dev environment anyway.
panic(err)
}

Expand All @@ -29,7 +37,4 @@ func init() {

dir = nextDir
}

// Uuuuhhh...
rootDir = "./internal/assets"
}

0 comments on commit 29294eb

Please sign in to comment.