# Go Path Issues Installing Sensu Go from Source

**URL:** <https://discourse.sensu.io/t/go-path-issues-installing-sensu-go-from-source/1869>\
**Category:** Sensu Go\
**Tags:** sensu-go\
**Created:** [June 11, 2020, 1:32pm UTC](https://discourse.sensu.io/t/go-path-issues-installing-sensu-go-from-source/1869 "2020-06-11T13:32:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ncoury](https://avatars.discourse-cdn.com/v4/letter/n/df788c/32.png) [@ncoury](https://discourse.sensu.io/u/ncoury)\
**Post date:** [June 11, 2020, 1:32pm UTC](https://discourse.sensu.io/t/go-path-issues-installing-sensu-go-from-source/1869/1 "2020-06-11T13:32:26Z")

</div>

Installing Sensu Go with the MIT license from source ([https://github.com/sensu/sensu-go](https://github.com/sensu/sensu-go)) has proved challenging. Following the directions presented in the readme.md does not let me install the service and instead I get a tremendous amount of go pathing issues.

* * *

## ubuntu@ip-10-4-1-129:~/go/src/github.com/sensu/sensu-go$ pwd /home/ubuntu/go/src/github.com/sensu/sensu-go ubuntu@ip-10-4-1-129:~/go/src/github.com/sensu/sensu-go$ echo GOPATH /home/ubuntu/go ubuntu@ip-10-4-1-129:~/go/src/github.com/sensu/sensu-go echo GOROOT /home/ubuntu/go ubuntu@ip-10-4-1-129:~/go/src/github.com/sensu/sensu-go ls CHANGELOG.md DCO README.md asset build.ps1 cmd docker-compose.yaml go.sum js rpc testing types CODE\_OF\_CONDUCT.md FAQ.md agent backend build.sh command docker-scripts graphql licenses scripts token util CONTRIBUTING.md LICENSE api bonsai cli dashboard go.mod handler process system transport version ubuntu@ip-10-4-1-129:~/go/src/github.com/sensu/sensu-go$ ls cmd loadit sensu-agent sensu-backend sensuctl ubuntu@ip-10-4-1-129:~/go/src/github.com/sensu/sensu-go$ ls cmd/sensu-backend/ LICENSE main.go ubuntu@ip-10-4-1-129:~/go/src/github.com/sensu/sensu-go$ go run ./cmd/sensu-backend warning: GOPATH set to GOROOT (/home/ubuntu/go) has no effect go run: no go files listed

As seen above my Go path is set to “/home/ubuntu/go”, but it doesn’t seem to recognize “sensu-go/cmd/sensu-backend/main.go” is a Go file.

When I try to build directly (not using the “run” command) I get the following pathing issues:

 ![image](https://us1.discourse-cdn.com/flex016/uploads/sensu/original/1X/5373eb2b38b11674267a3b0be7a3b9bbdf074ed0.jpeg)

There seems to be an ongoing issue with this regarding Go and Sensu-Go:

> <https://github.com/sensu/sensu-go/issues/1950>
>
> Expected Behavior
> I'm trying to build sensu but it seems like something is missing in documentation that is needed for the build...

---

<div class="post-metadata">

**Author:** ![todd](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/todd/32/936_2.png) [@todd](https://discourse.sensu.io/u/todd)\
**Post date:** [June 11, 2020, 2:59pm UTC](https://discourse.sensu.io/t/go-path-issues-installing-sensu-go-from-source/1869/2 "2020-06-11T14:59:43Z")

</div>

Using GOROOT and putting the source under your GOPATH is no longer required with newer versions of Go.

Here are the steps I used and was able to compile from source (Using Go 1.13.1 installed in /usr/local/go on Fedora 30) :

```
$ which go
/usr/local/go/bin/go
$ go version
go version go1.13.1 linux/amd64
$ env | grep GO
GOPATH=/home/todd/go
$ go build ./cmd/sensu-agent
go: downloading golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980
go: downloading github.com/gorilla/mux v1.7.3
go: downloading go.etcd.io/bbolt v1.3.4
[many lines of go: downloading deleted for brevity]
go: finding github.com/libp2p/go-reuseport v0.0.1
go: finding github.com/shirou/gopsutil v0.0.0-20190901111213-e4ec7b275ada
$ ls -l sensu-agent
-rwxrwxr-x 1 todd todd 72772879 Jun 11 07:56 sensu-agent
$ go build ./cmd/sensu-backend
go: downloading github.com/stretchr/testify v1.6.0
go: downloading github.com/mattn/go-isatty v0.0.8
[many lines of go: downloading deleted for brevity]
go: finding github.com/stretchr/testify v1.6.0
go: finding gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c
$ ls -l sensu-backend
-rwxrwxr-x 1 todd todd 86723826 Jun 11 07:58 sensu-backend
```

---

<div class="post-metadata">

**Author:** ![ncoury](https://avatars.discourse-cdn.com/v4/letter/n/df788c/32.png) [@ncoury](https://discourse.sensu.io/u/ncoury)\
**Post date:** [June 11, 2020, 3:43pm UTC](https://discourse.sensu.io/t/go-path-issues-installing-sensu-go-from-source/1869/3 "2020-06-11T15:43:39Z")

</div>

> [@todd](#):
>
> `go build ./cmd/sensu-agent`

Thank you Todd, I still have no luck following the steps above:

 ![image](https://us1.discourse-cdn.com/flex016/uploads/sensu/original/1X/18daa40de31b0aecd6a38575009c1db8270c0280.jpeg)

It seems like the main.go has the wrong path to the build files or something of that nature.

---

<div class="post-metadata">

**Author:** ![todd](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/todd/32/936_2.png) [@todd](https://discourse.sensu.io/u/todd)\
**Post date:** [June 11, 2020, 3:59pm UTC](https://discourse.sensu.io/t/go-path-issues-installing-sensu-go-from-source/1869/4 "2020-06-11T15:59:36Z")

</div>

Ah, your version of Go is _way_ outdated and doesn’t support the new modules paradigm. You will need a newer version of Go. I suggest the latest iteration of 1.13.

---

<div class="post-metadata">

**Author:** ![ncoury](https://avatars.discourse-cdn.com/v4/letter/n/df788c/32.png) [@ncoury](https://discourse.sensu.io/u/ncoury)\
**Post date:** [June 11, 2020, 5:19pm UTC](https://discourse.sensu.io/t/go-path-issues-installing-sensu-go-from-source/1869/5 "2020-06-11T17:19:47Z")

</div>

Perfect! That worked for me, thank you Todd!
