# Error "unknown command: go"

**URL:** <https://discourse.gohugo.io/t/error-unknown-command-go/40761>\
**Category:** support\
**Created:** [October 1, 2022, 7:50am UTC](https://discourse.gohugo.io/t/error-unknown-command-go/40761 "2022-10-01T07:50:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![itaysk](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/itaysk/32/17871_2.png) [@itaysk](https://discourse.gohugo.io/u/itaysk)\
**Post date:** [October 1, 2022, 7:50am UTC](https://discourse.gohugo.io/t/error-unknown-command-go/40761/1 "2022-10-01T07:50:01Z")

</div>

When trying to build a hugo site with modules, hugo fails to get modules, because it can’t run go tool.  
go and hugo was installed using asdf ([https://asdf-vm.com/](https://asdf-vm.com/)). go is working fine from any terminal configuration I tried.  
Has anyone experienced using hugo with asdf?

```auto
❯ hugo mod get -u
unknown command: go. Perhaps you have to reshim?
WARN 2022/10/01 10:42:04 failed to download modules: failed to execute 'go [mod download]': failed to execute binary "go" with args [mod download]: unknown command: go. Perhaps you have to reshim?
 *errors.errorString
unknown command: go. Perhaps you have to reshim?
Error: failed to get ["-d" "-u" "github.com/some/module"]: failed to execute 'go [get -d -u github.com/some/module]': failed to execute binary "go" with args [get -d -u github.com/some/module]: unknown command: go. Perhaps you have to reshim?
 *errors.errorString

```

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [October 1, 2022, 3:16pm UTC](https://discourse.gohugo.io/t/error-unknown-command-go/40761/2 "2022-10-01T15:16:41Z")

</div>

I suspect this is caused by Hugo’s [security policy](https://gohugo.io/about/security-model/#security-policy), specifically `security.exec.osEnv`.

The default value is:

```nohighlight
[security.exec]
osEnv = ['(?i)^((HTTPS?|NO)_PROXY|PATH(EXT)?|APPDATA|TE?MP|TERM)$']

```

In your site configuration, change this to:

```nohighlight
[security.exec]
osEnv = ['(?i)^((HTTPS?|NO)_PROXY|PATH(EXT)?|APPDATA|TE?MP|TERM|HOME|ASDF_DIR)$']

```

If that doesn’t work, change it to:

```nohighlight
[security.exec]
osEnv = ['.*']

```

See [https://github.com/gohugoio/hugo/issues/9811](https://github.com/gohugoio/hugo/issues/9811)

---

<div class="post-metadata">

**Author:** ![itaysk](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/itaysk/32/17871_2.png) [@itaysk](https://discourse.gohugo.io/u/itaysk)\
**Post date:** [October 2, 2022, 6:42am UTC](https://discourse.gohugo.io/t/error-unknown-command-go/40761/3 "2022-10-02T06:42:28Z")

</div>

Adding the asdf path worked. Thank you!

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [October 4, 2022, 6:43am UTC](https://discourse.gohugo.io/t/error-unknown-command-go/40761/4 "2022-10-04T06:43:11Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
