I am fairly new to using Go and I have noticed when I build the Go project I have cloned from GitHub via:
$ go build
The executable is built, but when I run:
$ mediamtx --version
I get v0.0.0
I Googled the issue and found that I could set the Idflags parameter to set the version on build so I tried:
go build -ldflags="-X 'github.com/bluenviron/mediamtx/internal/core.Version=v1.5.0'"
Unfortunately, I ended up with the exact same problem, and Idflags appears to do nothing, with no errors the executable still builds. I have tried deleting and starting again from a git clone and running the command with sudo, haven't managed to get it to work, and not sure what I am doing wrong. This is what I am trying to go build with Idflags :
This is the content of my main.go which I got my path for GitHub to include in my Idflags directive
// main executable.
package main
import (
"os"
"github.com/bluenviron/mediamtx/internal/core"
)
func main() {
s, ok := core.New(os.Args[1:])
if !ok {
os.Exit(1)
}
s.Wait()
}