Skip to content

Commit

Permalink
Merge pull request #67 from ethstorage/issues
Browse files Browse the repository at this point in the history
add make file to make the built es-node versoin contain
  • Loading branch information
ping-ke authored Nov 23, 2023
2 parents 47dcfed + 6979015 commit d10a44e
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 7 deletions.
2 changes: 1 addition & 1 deletion GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ npm install -g [email protected]
```
#### 4. Build es-node
```sh
cd cmd/es-node && go build && cd ../..
make
```
#### 5. Start es-node
```sh
Expand Down
28 changes: 28 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
GITCOMMIT := $(shell git rev-parse HEAD)
GITDATE := $(shell git show -s --format='%ct')
BUILDDATE := $(shell date)

LDFLAGSSTRING +=-X main.GitCommit=$(GITCOMMIT)
LDFLAGSSTRING +=-X main.GitDate=$(GITDATE)
LDFLAGSSTRING +=-X main.Meta=$(VERSION_META)
LDFLAGSSTRING +=-X 'main.BuildTime=$(BUILDDATE)'
LDFLAGS := -ldflags "$(LDFLAGSSTRING)"

es-node:
env GO111MODULE=on GOOS=$(TARGETOS) GOARCH=$(TARGETARCH) go build -v $(LDFLAGS) -o ./cmd/es-node/es-node ./cmd/es-node/

clean:
rm ./cmd/es-node/es-node

test:
go test -v ./...

lint:
golangci-lint run -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint -e "errors.As" -e "errors.Is"


.PHONY: \
es-node \
clean \
test \
lint
22 changes: 16 additions & 6 deletions cmd/es-node/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"net"
"os"
"os/signal"
"runtime"
"strconv"
"strings"
"syscall"
Expand All @@ -26,10 +27,13 @@ import (
)

var (
GitCommit = ""
GitDate = ""
Version = "v0.1.1"
Meta = "dev"
GitCommit = ""
GitDate = ""
Version = "v0.1.1"
Meta = "dev"
BuildTime = ""
systemVersion = fmt.Sprintf("%s/%s", runtime.GOARCH, runtime.GOOS)
golangVersion = runtime.Version()
)

// VersionWithMeta holds the textual version string including the metadata.
Expand All @@ -47,15 +51,21 @@ var VersionWithMeta = func() string {
return v
}()

var BuildInfo = func() string {
return fmt.Sprintf(
"%s\nBuild date: %s\nSystem version: %s\nGolang version: %s",
VersionWithMeta, BuildTime, systemVersion, golangVersion)
}()

func main() {
// Set up logger with a default INFO level in case we fail to parse flags,
// otherwise the final critical log won't show what the parsing error was.
eslog.SetupDefaults()

app := cli.NewApp()
app.Version = VersionWithMeta
app.Version = BuildInfo
app.Flags = flags.Flags
app.Name = "es-node"
app.Name = "EthStorage node"
app.Usage = "EthStorage Storage Node"
app.Description = "The EthStorage Storage Node derives L2 datahashes of the values of KV store from L1 data and reconstructs the values via L1 DA and ES P2P network."
app.Action = EsNodeMain
Expand Down

0 comments on commit d10a44e

Please sign in to comment.