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

Fixing spawn_test for go 1.21 #208

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pfgray
Copy link

@pfgray pfgray commented Feb 9, 2024

In go 1.21, go env changed the way it printed values

go version < 1.21:

GOPATH="/vaulted"
...

go >= 1.21:

GOPATH='/vaulted'
...

Which causes spawn_test.go to fail, since it's looking for exactly GOPATH="/vaulted" in go env's output.

This commit updates the test to look for single quotes or double quotes, making it compatible with all versions of go.

spawn_test.go Outdated

"github.com/miquella/vaulted/lib"
)

func TestSpawn(t *testing.T) {
spawnRefreshVar := `GOPATH="/vaulted"`
spawnRefreshVar := `GOPATH=["|']/vaulted`
Copy link

Choose a reason for hiding this comment

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

Isn't the | wrong? ["'] should be correct? Otherwise you will also match |/valued which I don't think you want to do.

Copy link
Author

Choose a reason for hiding this comment

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

indeed, fixed!

In go 1.21, `go env` changed the way it printed values

go version < 1.21:
```
GOPATH="/vaulted"
...
```

go >= 1.21:
```
GOPATH='/vaulted'
...
```

Which causes `spawn_test.go` to fail, since it's looking for exactly
`GOPATH="/vaulted"` in `go env`'s output.

This commit updates the test to look for single quotes or double quotes,
making it compatible with all versions of go.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants