Index out of range while trying to run with envvar
- Dominant language
- Go
- Stars
- 622
- Forks
- 20
- PR merge metrics
- No merged PRs in 30d
Description
When I tried to set the environment variable `NAME` to `foo` and ran httpu, I noticed a index out of range panic.
It seems to me that whenever the length of `NAME` is lesser than the length of `$env{[NAME]}`, this issue happens.
Here's the stack trace
```
$ NAME=foo ./main new httpbin
panic: runtime error: index out of range
goroutine 1 [running]:
panic
../../../libgo/go/runtime/panic.go:557
runtime_panicstring
../../../libgo/runtime/panic.c:38
github_com_hazbo_httpu_vendor_github_com_hazbo_httpu_utils_varparser.VarParser.Parse
go/src/github.com/hazbo/httpu/vendor/github.com/hazbo/httpu/utils/varparser/varparser.go:43
github_com_hazbo_httpu_vendor_github_com_hazbo_httpu_env.Parse
go/src/github.com/hazbo/httpu/vendor/github.com/hazbo/httpu/env/env.go:24
github_com_hazbo_httpu_vendor_github_com_hazbo_httpu_resource_request.RequestSpec.parseEnvVars
go/src/github.com/hazbo/httpu/vendor/github.com/hazbo/httpu/resource/request/modifier.go:40
github_com_hazbo_httpu_vendor_github_com_hazbo_httpu_resource_request.RequestSpec.Update
go/src/github.com/hazbo/httpu/vendor/github.com/hazbo/httpu/resource/request/modifier.go:15
github_com_hazbo_httpu_vendor_github_com_hazbo_httpu_resource.FilePath.Load
go/src/github.com/hazbo/httpu/vendor/github.com/hazbo/httpu/resource/resource.go:122
github_com_hazbo_httpu_vendor_github_com_hazbo_httpu.ConfigureFromFile
go/src/github.com/hazbo/httpu/vendor/github.com/hazbo/httpu/configure.go:76
commands.newValue
go/src/github.com/hazbo/httpu/vendor/github.com/hazbo/httpu/cmd/httpu/commands/new.go:41
commands.func2
go/src/github.com/hazbo/httpu/vendor/github.com/hazbo/httpu/cmd/httpu/commands/new.go:58
github_com_hazbo_httpu_vendor_github_com_hazbo_httpu_cmd_httpu_commands.Command.Run
go/src/github.com/hazbo/httpu/vendor/github.com/hazbo/httpu/cmd/httpu/commands/commands.go:12
main.main
go/src/github.com/hazbo/httpu/cmd/httpu/main.go:60
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.