Skip to content

Commit

Permalink
chore: deprecate glide in go targets (#345)
Browse files Browse the repository at this point in the history
* chore(golang/glide): deprecate in favor of go mod

* chore(golang): remove glide altogether

* docs(go/deps): remove go/deps-build

* Auto Format

* fix(go/deps): remove stray refs to glide

---------

Co-authored-by: cloudpossebot <[email protected]>
  • Loading branch information
dudymas and cloudpossebot authored Apr 11, 2023
1 parent a50af33 commit ca08a9f
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 27 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ WORKDIR /build-harness
ARG PACKAGES_PREFER_HOST=true
RUN make -s bash/lint make/lint
RUN make -s template/deps readme/deps
RUN make -s go/deps-build go/deps-dev
RUN make -s go/deps-dev

ENTRYPOINT ["/usr/bin/make"]
#ENTRYPOINT ["/bin/sh"]
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,8 @@ Available targets:
go/build Build binary
go/build-all Build binary for all platforms
go/clean Clean compiled binary
go/clean-all Clean compiled binary and dependency
go/clean-all Clean compiled binary and dependencies
go/deps Install dependencies
go/deps-build Install dependencies for build
go/deps-dev Install development dependencies
go/fmt Format code according to Golang convention
go/install Install cli
Expand Down
2 changes: 1 addition & 1 deletion docs/demo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions docs/targets.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,8 @@ Available targets:
go/build Build binary
go/build-all Build binary for all platforms
go/clean Clean compiled binary
go/clean-all Clean compiled binary and dependency
go/clean-all Clean compiled binary and dependencies
go/deps Install dependencies
go/deps-build Install dependencies for build
go/deps-dev Install development dependencies
go/fmt Format code according to Golang convention
go/install Install cli
Expand Down
24 changes: 7 additions & 17 deletions modules/go/Makefile.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
GLIDE := $(shell which glide 2>/dev/null)
INSTALL_DIR ?= /usr/local/sbin
RELEASE_DIR ?= release
APP ?= $(shell basename `pwd`)
Expand All @@ -18,18 +17,10 @@ else
endif

## Install dependencies
go/deps: $(GLIDE)
$(call assert-set,GLIDE)
$(GLIDE) install --strip-vendor
$(GLIDE) update --strip-vendor

## Install dependencies for build
go/deps-build:
$(call assert-set,GOPATH)
mkdir -p $(GOPATH)/bin
# 2022-098-02 https://glide.sh/get no longer works (parked domain, bad SSL cert)
# which $(GLIDE) || (curl https://glide.sh/get | sh)
which $(GLIDE) || apk add --no-cache glide
go/deps: $(GO)
$(call assert-set,GO)
$(GO) get
$(GO) mod tidy

## Install development dependencies
go/deps-dev: $(GO)
Expand All @@ -40,11 +31,10 @@ go/deps-dev: $(GO)
## Clean compiled binary
go/clean:
rm -rf $(RELEASE_DIR)

## Clean compiled binary and dependency
## Clean compiled binary and dependencies
go/clean-all: go/clean
rm -rf vendor
rm -rf glide.lock
$(GO) mod download

## Install cli
go/install: $(APP) go/build
Expand Down
6 changes: 3 additions & 3 deletions modules/go/Makefile.style
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
## Lint code
go/lint: $(GO) go/vet
$(call assert-set,GO)
find . ! -path "*/vendor/*" ! -path "*/.glide/*" -type f -name '*.go' | xargs -n 1 golint
find . -type f -name '*.go' | xargs -n 1 golint

## Vet code
go/vet: $(GO)
$(call assert-set,GO)
find . ! -path "*/vendor/*" ! -path "*/.glide/*" -type f -name '*.go' | xargs $(GO) tool vet -v
find . -type f -name '*.go' | xargs $(GO) tool vet -v

## Format code according to Golang convention
go/fmt: $(GO)
$(call assert-set,GO)
find . ! -path "*/vendor/*" ! -path "*/.glide/*" -type f -name '*.go' | xargs -n 1 gofmt -w -l -s
find . -type f -name '*.go' | xargs -n 1 gofmt -w -l -s
20 changes: 20 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{ goVersion ? "19"
, overlays ? [ (self: super: { go = super."go_1_${toString goVersion}"; }) ]
, pkgs ? import <nixpkgs> { inherit overlays; }
}:
pkgs.mkShell {
packages = with pkgs; [
go #set in overlays
go-tools
gotools
# https://github.com/golangci/golangci-lint
golangci-lint
# The Go language server (for IDEs and such)
gopls
# https://pkg.go.dev/github.com/ramya-rao-a/go-outline
go-outline
# https://github.com/uudashr/gopkgs
gopkgs
delve
];
}
1 change: 0 additions & 1 deletion templates/go.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ env:

install:
- make init
- make go/deps-build
- make go/deps-dev

script:
Expand Down

0 comments on commit ca08a9f

Please sign in to comment.