Correct way of building with go?

Moderators: kirk, jamesbond, p310don, JakeSFR, step, Forum moderators

Post Reply
libertas
Posts: 119
Joined: Thu Apr 22, 2021 8:35 pm
Has thanked: 24 times
Been thanked: 3 times

Correct way of building with go?

Post by libertas »

Hi,

I'm building a package for syncthing.
It needs go to build it.
From gslapt, I've installed go package.
The go binary was installed in /opt/go-1.22.4/bin/go.

In the recipe, I've included this:

Code: Select all

pkg_build() { 
	cd /tmp/syncthing*
	export PATH=/opt/go-1.22.4/bin:$PATH
	go run build.go && cp ./bin/* /usr/local/bin/ && pkg_build_slackdesc
}

It works, builds and install the binaries fine, but the go installation path is hard coded.
Now, it's version 1.22.4, tomorrow can be different.
How can I do this in a better way?

User avatar
Keef
Posts: 283
Joined: Tue Dec 03, 2019 8:05 pm
Has thanked: 3 times
Been thanked: 77 times

Re: Correct way of building with go?

Post by Keef »

Symlink to /opt/go ? That's the way go is normally installed I think.

libertas
Posts: 119
Joined: Thu Apr 22, 2021 8:35 pm
Has thanked: 24 times
Been thanked: 3 times

Re: Correct way of building with go?

Post by libertas »

That's it.
Thank you @Keef.
I hadn't noticed the symlink.

Post Reply

Return to “Software”