Add -trimpath flag to the builds (#13348)
Go 1.13 introduced this new flag which removes all absolute file system paths from the binary and just keeps the module path / GOPATH. To debug binary crashes or stack traces, we only need the path to the code and not the full file path. Hence this is a quick way to reduce the binary size without any information loss. Shaves off around 750KB from the server binary.
Этот коммит содержится в:
коммит произвёл
Carlos Tadeu Panato Junior
родитель
89c0b61bc3
Коммит
e2e2ad48ce
@@ -3,15 +3,15 @@ dist: | check-style test package
|
||||
|
||||
build-linux:
|
||||
@echo Build Linux amd64
|
||||
env GOOS=linux GOARCH=amd64 $(GO) install -i $(GOFLAGS) -ldflags '$(LDFLAGS)' ./...
|
||||
env GOOS=linux GOARCH=amd64 $(GO) install $(GOFLAGS) -trimpath -ldflags '$(LDFLAGS)' ./...
|
||||
|
||||
build-osx:
|
||||
@echo Build OSX amd64
|
||||
env GOOS=darwin GOARCH=amd64 $(GO) install -i $(GOFLAGS) -ldflags '$(LDFLAGS)' ./...
|
||||
env GOOS=darwin GOARCH=amd64 $(GO) install $(GOFLAGS) -trimpath -ldflags '$(LDFLAGS)' ./...
|
||||
|
||||
build-windows:
|
||||
@echo Build Windows amd64
|
||||
env GOOS=windows GOARCH=amd64 $(GO) install -i $(GOFLAGS) -ldflags '$(LDFLAGS)' ./...
|
||||
env GOOS=windows GOARCH=amd64 $(GO) install $(GOFLAGS) -trimpath -ldflags '$(LDFLAGS)' ./...
|
||||
|
||||
build: build-linux build-windows build-osx
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user