I am embeddingsrcs into a go_library
to boostrap an embed.FS
variable. It took some time to sort this out (see bazel go_embed_data "could not embed").
The new problem I have is I am receiving a SIGSEGV during runtime I'm seeing unexpected fault address 0x0
The bazel BUILD and go code is below
go_library(
name = "my_lib",
srcs = ["main.go"],
embedsrcs = glob(["static/**/*"]),
importpath = "github.com/myorg/myrepo",
visibility = ["//visibility:private"],
deps = ["//cmd"],
)
go_binary(
name = "my_linux_amd64",
cgo = True,
embed = [":my_lib"],
gc_goopts = [
"-dynlink",
],
goarch = "amd64",
goos = "linux",
linkmode = "pie",
visibility = ["//visibility:public"],
)
package main
import (
"embed"
)
//go:embed static/*
var staticFS embed.FS // fault address
Not sure how to resolve this.