Skip to content

Commit fee9455

Browse files
committed
Update copyrights, Makefile, switch to Go modules
1 parent cf6c815 commit fee9455

16 files changed

Lines changed: 155 additions & 197 deletions

Gopkg.lock

Lines changed: 0 additions & 41 deletions
This file was deleted.

Gopkg.toml

Lines changed: 0 additions & 38 deletions
This file was deleted.

Makefile

Lines changed: 34 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,59 @@
1-
PKGNAME = proc-maps
2-
SUBPKGS = cli data sorts
3-
PROJREPO = github.com/DataDrake
1+
PKGNAME = proc-maps
2+
DESTDIR ?=
3+
PREFIX ?= /usr
4+
BINDIR = $(PREFIX)/bin
45

5-
include Makefile.golang
6-
include Makefile.waterlog
6+
GOPROJROOT = $(GOSRC)/$(PROJREPO)
7+
8+
GOLDFLAGS = -ldflags "-s -w"
9+
GOCC = CGO_ENABLED=0 go
10+
GOFMT = $(GOCC) fmt -x
11+
GOGET = $(GOCC) get $(GOLDFLAGS)
12+
GOBUILD = $(GOCC) build -v $(GOLDFLAGS)
13+
GOTEST = $(GOCC) test
14+
GOVET = $(GOCC) vet
15+
GOINSTALL = $(GOCC) install $(GOLDFLAGS)
716

8-
MEGACHECK = $(GOBIN)/staticcheck
9-
GOLINT = $(GOBIN)/golint -set_exit_status
17+
include Makefile.waterlog
1018

11-
DESTDIR ?=
12-
PREFIX ?= /usr
13-
BINDIR = $(PREFIX)/bin
19+
GOLINT = golint -set_exit_status
20+
STATICCHECK = staticcheck
1421

1522
all: build
1623

17-
build: setup setup-deps
24+
build:
1825
@$(call stage,BUILD)
19-
@$(GOINSTALL) $(PROJREPO)/$(PKGNAME)
26+
@$(GOBUILD)
2027
@$(call pass,BUILD)
2128

22-
setup:
23-
@$(call stage,SETUP)
24-
@$(call task,Setting up project root...)
25-
@mkdir -p $(GOPROJROOT)
26-
@$(call task,Setting up symlinks...)
27-
@if [ ! -d $(GOPROJROOT)/$(PKGNAME) ]; then ln -s $(shell pwd) $(GOPROJROOT)/$(PKGNAME); fi
28-
@$(call pass,SETUP)
29-
3029
test: build
3130
@$(call stage,TEST)
32-
@for d in $(SUBPKGS); do $(GOTEST) ./$$d/... || exit 1; done
31+
@$(GOTEST) ./...
3332
@$(call pass,TEST)
3433

35-
validate: setup-deps
34+
setup:
35+
@$(call stage,EXTRA-DEPS)
36+
@$(GOCC) mod download
37+
@$(call pass,EXTRA-DEPS)
38+
39+
validate: setup
3640
@$(call stage,FORMAT)
37-
@for d in $(SUBPKGS); do $(GOFMT) ./$$d/...|| exit 1; done || $(GOFMT) $(PKGNAME).go
41+
@$(GOFMT) ./...
3842
@$(call pass,FORMAT)
3943
@$(call stage,VET)
4044
@$(call task,Running 'go vet'...)
41-
@cd $(GOPROJROOT)/$(PKGNAME); for d in $(SUBPKGS); do $(GOVET) ./... && exit 1; done || $(GOVET) $(PKGNAME).go || exit 1
42-
@$(call task,Running 'staticcheck'...)
43-
@for d in $(SUBPKGS); do $(MEGACHECK) ./$$d || exit 1; done || $(MEGACHECK) $(PKGNAME).go || exit 1
45+
@$(GOVET) ./...
4446
@$(call pass,VET)
4547
@$(call stage,LINT)
4648
@$(call task,Running 'golint'...)
47-
@for d in $(SUBPKGS); do $(GOLINT) ./$$d/... || exit 1; done || $(GOLINT) $(PKGNAME).go || exit 1;
49+
@$(GOLINT) ./...
50+
@$(call task,Running 'staticcheck'...)
51+
@$(STATICCHECK) ./...
4852
@$(call pass,LINT)
4953

50-
setup-deps:
51-
@$(call stage,DEPS)
52-
@if [ ! -e $(GOBIN)/dep ]; then \
53-
$(call task,Installing dep...); \
54-
$(GOGET) -d github.com/golang/dep/cmd/dep; \
55-
pushd build/src/github.com/golang/dep/cmd/dep; \
56-
git checkout tags/v0.4.1; \
57-
$(GOINSTALL) ./...; \
58-
popd; \
59-
fi
60-
@if [ ! -e $(GOBIN)/staticcheck ]; then \
61-
$(call task,Installing staticcheck...); \
62-
$(GOGET) honnef.co/go/tools/cmd/staticcheck; \
63-
fi
64-
@if [ -d build/src/honnef.co ]; then rm -rf build/src/honnef.co; fi
65-
@if [ ! -e $(GOBIN)/golint ]; then \
66-
$(call task,Installing golint...); \
67-
$(GOGET) golang.org/x/lint/golint; \
68-
fi
69-
@if [ -d build/src/golang.org ]; then rm -rf build/src/golang.org; fi
70-
@if [ -d build/src/github.com/golang ]; then rm -rf build/src/github.com/golang; fi
71-
@if [ ! -d vendor ]; then \
72-
$(call task,Getting build dependencies...); \
73-
cd $(GOPROJROOT)/$(PKGNAME); GOPATH=$(GOPATH) $(GOBIN)/dep ensure; \
74-
fi
75-
7654
install:
7755
@$(call stage,INSTALL)
78-
install -D -m 00755 $(GOBIN)/$(PKGNAME) $(DESTDIR)$(BINDIR)/$(PKGNAME)
56+
install -Dm 00755 $(PKGNAME) $(DESTDIR)$(BINDIR)/$(PKGNAME)
7957
@$(call pass,INSTALL)
8058

8159
uninstall:
@@ -85,8 +63,6 @@ uninstall:
8563

8664
clean:
8765
@$(call stage,CLEAN)
88-
@$(call task,Removing symlinks...)
89-
@unlink $(GOPROJROOT)/$(PKGNAME)
90-
@$(call task,Removing build directory...)
91-
@rm -rf build
66+
@$(call task,Removing executable...)
67+
@rm $(PKGNAME)
9268
@$(call pass,CLEAN)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ rw-p 4K 80
116116

117117
### License
118118

119-
Copyright 2018 Bryan T. Meyers <bmeyers@datadrake.com>
119+
Copyright 2018-2020 Bryan T. Meyers <bmeyers@datadrake.com>
120120

121121
Licensed under the Apache License, Version 2.0 (the "License");
122122
you may not use this file except in compliance with the License.

cli/file-stats.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Copyright 2017 Bryan T. Meyers <bmeyers@datadrake.com>
2+
// Copyright 2017-2020 Bryan T. Meyers <bmeyers@datadrake.com>
33
//
44
// Licensed under the Apache License, Version 2.0 (the "License");
55
// you may not use this file except in compliance with the License.

cli/rank-all-sizes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Copyright 2017 Bryan T. Meyers <bmeyers@datadrake.com>
2+
// Copyright 2017-2020 Bryan T. Meyers <bmeyers@datadrake.com>
33
//
44
// Licensed under the Apache License, Version 2.0 (the "License");
55
// you may not use this file except in compliance with the License.

cli/rank-sizes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Copyright 2017 Bryan T. Meyers <bmeyers@datadrake.com>
2+
// Copyright 2017-2020 Bryan T. Meyers <bmeyers@datadrake.com>
33
//
44
// Licensed under the Apache License, Version 2.0 (the "License");
55
// you may not use this file except in compliance with the License.

cli/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Copyright 2018 Bryan T. Meyers <bmeyers@datadrake.com>
2+
// Copyright 2018-2020 Bryan T. Meyers <bmeyers@datadrake.com>
33
//
44
// Licensed under the Apache License, Version 2.0 (the "License");
55
// you may not use this file except in compliance with the License.

data/entries.go

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Copyright 2018 Bryan T. Meyers <bmeyers@datadrake.com>
2+
// Copyright 2018-2020 Bryan T. Meyers <bmeyers@datadrake.com>
33
//
44
// Licensed under the Apache License, Version 2.0 (the "License");
55
// you may not use this file except in compliance with the License.
@@ -41,15 +41,19 @@ type FileEntry struct {
4141
// Increment entry by new address range
4242
func (f *FileEntry) Increment(startAddress, endAddress, permissions string) {
4343
start, err := strconv.ParseUint(startAddress, 16, 64)
44+
if err != nil {
45+
panic(err)
46+
}
4447
end, err := strconv.ParseUint(endAddress, 16, 64)
45-
if err == nil {
46-
f.Sizes[permissions] = &SizeEntry{
47-
Size: end - start,
48-
Refs: 1,
49-
}
50-
f.Total += end - start
51-
f.Weight += end - start
48+
if err != nil {
49+
panic(err)
50+
}
51+
f.Sizes[permissions] = &SizeEntry{
52+
Size: end - start,
53+
Refs: 1,
5254
}
55+
f.Total += end - start
56+
f.Weight += end - start
5357
}
5458

5559
// Print summarizes the stats related to a FileEntry

data/format.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Copyright 2018 Bryan T. Meyers <bmeyers@datadrake.com>
2+
// Copyright 2018-2020 Bryan T. Meyers <bmeyers@datadrake.com>
33
//
44
// Licensed under the Apache License, Version 2.0 (the "License");
55
// you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)