Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add ldflags -w/-s to builds #34

Merged
merged 1 commit into from
May 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
- name: Build on ${{runner.os}}
run: |
#Building for main platform
go build -o dkc-${{env.release_version}}-${{env.goos}}-${{env.goarch}} -ldflags="-X github.com/p2p-org/dkc/cmd.ReleaseVersion=${{env.release_version}}" .
go build -o dkc-${{env.release_version}}-${{env.goos}}-${{env.goarch}} -ldflags="-s -w -X github.com/p2p-org/dkc/cmd.ReleaseVersion=${{env.release_version}}" .
tar zcf dkc-${{env.release_version}}-${{env.goos}}-${{env.goarch}}.tar.gz dkc-${{env.release_version}}-${{env.goos}}-${{env.goarch}}
shasum -a 256 dkc-${{env.release_version}}-${{env.goos}}-${{env.goarch}}.tar.gz >dkc-${{env.release_version}}-${{env.goos}}-${{env.goarch}}.sha256

Expand Down
4 changes: 2 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
e2types "github.com/wealdtech/go-eth2-types/v2"
)

var ReleaseVersion = "v0.0.1"
var ReleaseVersion string

var (
cfgFile string
Expand Down Expand Up @@ -47,12 +47,12 @@ func init() {
}
func initConfig() {
viper.SetConfigFile(cfgFile)
viper.Set("version", ReleaseVersion)

viper.SetEnvPrefix("DKC")
viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_"))
viper.AutomaticEnv()
if err := viper.ReadInConfig(); err == nil {
viper.Set("version", ReleaseVersion)
utils.InitLogging()
}
}
2 changes: 0 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import (
"github.com/p2p-org/dkc/cmd"
)

var ReleaseVersion = "v0.0.1"

func main() {
cmd.Execute()
}
11 changes: 9 additions & 2 deletions nix/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,21 @@
...
}: let
inherit (inputs'.ethereum-nix.packages) mcl bls;
pname = "dkc";
version = "1.0.0";
dkc = pkgs.buildGoModule {
pname = "dkc";
version = "1.0.0";
inherit pname version;
src = ../.;

vendorHash = "sha256-EtGm+9jpGGB+/aUzIyFfe3ZbyhqliL3G9qJBf2nKseY=";

buildInputs = [mcl bls];

ldflags = [
"-s"
"-w"
"-X github.com/p2p-org/dkc/cmd.ReleaseVersion=${version}"
];
};
in {
packages.dkc = dkc;
Expand Down