func Snapshot() error {
	if err := envGoVersion(); err != nil {
		return err
	}
	return goreleaser("--snapshot")
}
Snapshot creates a local snapshot release without publishing to GitHub.
package main
import (
	"fmt"
	"os"
	"path/filepath"
	"github.com/magefile/mage/sh"
	"github.com/magefile/mage/target"
)
const (
	app       = "conntracct"
	buildPath = "build/conntracct"
)
var (
	buildEnv = map[string]string{
		"CGO_ENABLED": "0",
	}
	build = func() error {
		return sh.RunWith(buildEnv, "go", "build", "-o", buildPath)
	}
	goreleaser = sh.RunCmd("goreleaser", "release", "--rm-dist")
)
func Build() error {
	mod, err := target.Dir(buildPath, "bpf", "pkg", "cmd", "internal")
	if err != nil {
		return err
	}
	if mod {
		realPath := realPath(buildPath)
		if err := sh.Rm(realPath); err != nil {
			return err
		}
		if err := build(); err != nil {
			return err
		}
		if err := sh.Run("sudo", "setcap", "cap_sys_admin,cap_ipc_lock,cap_net_admin,cap_dac_override,cap_sys_resource+eip", realPath); err != nil {
			return err
		}
		fmt.Printf("Successfully built %s!\n", buildPath)
		return nil
	}
	fmt.Println(buildPath, "already up to date.")
	return nil
}
func Dev() error {
	if err := sh.Run("docker-compose", "-f", "test/docker-compose.yml", "-p", app, "up", "-d"); err != nil {
		return err
	}
	fmt.Println("Starting live-reload with modd..")
	if err := sh.RunV("modd"); err != nil {
		return err
	}
	return nil
}
func Generate() error {
	if err := sh.RunV("go", "generate", "-x", "./..."); err != nil {
		return err
	}
	fmt.Println("Successfully ran go generate.")
	return nil
}
func Lint() error {
	return sh.RunV("golangci-lint", "run")
}
func Release() error {
	if err := envGoVersion(); err != nil {
		return err
	}
	return goreleaser()
}