How to build a 3rd-party executable file into a go executable?

41 Views Asked by At

I want to build chromium into a go executable file with go build, so that users can run the executable file without installing chromium.

// my go code snippets
...

import "github.com/chromedp/chromedp"

opts := []chromedp.ExecAllocatorOption{
        chromede.ExecPath("./chromium")
}
...

In my study, go:embed might solve my problem. However, I haven't found any examples for embedding executable files, just for embedding data files (ex: csv, txt, ...). I have two questions,

  1. How to build an executable file into a go executable?
  2. Is that a common practice? Or it's the user responsibility to install the dependencies.
0

There are 0 best solutions below