File tree 4 files changed +55
-9
lines changed
4 files changed +55
-9
lines changed Original file line number Diff line number Diff line change
1
+ .PHONY : build help install lint test uninstall
2
+
3
+ # Set go modules to on and use GoCenter for immutable modules
4
+ export GO111MODULE = on
5
+ export GOPROXY = https ://proxy.golang.org,direct
6
+
7
+ # Determines the path to this Makefile
8
+ THIS_FILE := $(lastword $(MAKEFILE_LIST ) )
9
+
10
+ APP =til
11
+
12
+ # # build: builds a local version
13
+ build :
14
+ go build -o bin/${APP}
15
+ @echo " Done building"
16
+
17
+ # # help: prints this help message
18
+ help :
19
+ @echo " Usage: \n"
20
+ @sed -n ' s/^##//p' ${MAKEFILE_LIST} | column -t -s ' :' | sed -e ' s/^/ /'
21
+
22
+ # # install: installs a local version of the app
23
+ install :
24
+ @echo " Installing ${APP} ..."
25
+ @go clean
26
+ @go install -ldflags=" -s -w"
27
+ $(eval INSTALLPATH = $(shell which ${APP}) )
28
+ @echo " ${APP} installed into ${INSTALLPATH} "
29
+
30
+ # # lint: runs a number of code quality checks against the source code
31
+ lint :
32
+ @echo " \033[35mhttps://github.com/kisielk/errcheck\033[0m"
33
+ errcheck ./til.go
34
+
35
+ @echo "\033[35mhttps://golang.org/cmd/vet/k\033[0m"
36
+ go vet ./til.go
37
+
38
+ @echo "\033[35m# https://staticcheck.io/docs/k\033[0m"
39
+ staticcheck ./til.go
40
+
41
+ @echo "\033[35m# https://github.com/mdempsky/unconvert\033[0m"
42
+ unconvert ./...
43
+
44
+ # # test: runs the test suite
45
+ test : build
46
+ go test ./...
47
+
48
+ # # uninstall: uninstals a locally-installed version
49
+ uninstall :
50
+ @rm ~ /go/bin/${APP}
Original file line number Diff line number Diff line change @@ -33,7 +33,6 @@ editor: ""
33
33
targetDirectory: "~/Documents/til"
34
34
`
35
35
defaultEditor = "open"
36
-
37
36
fileExtension = "md"
38
37
39
38
// A custom datetime format that plays nicely with GitHub Pages filename restrictions
66
65
67
66
// Red writes red text
68
67
Red = Colour ("\033 [1;31m%s\033 [0m" )
69
-
70
- // Yellow writes yellow text
71
- Yellow = Colour ("\033 [1;33m%s\033 [0m" )
72
68
)
73
69
74
70
// globalConfig holds and makes available all the user-configurable
@@ -196,7 +192,7 @@ func makeConfigDir() {
196
192
func makeConfigFile () {
197
193
cPath := getConfigPath ()
198
194
199
- fileInfo , err := os .Stat (cPath )
195
+ _ , err := os .Stat (cPath )
200
196
201
197
if err != nil {
202
198
// Something went wrong trying to find the config file.
@@ -217,7 +213,7 @@ func makeConfigFile() {
217
213
}
218
214
219
215
// Let's double-check that the file's there now
220
- fileInfo , err = os .Stat (cPath )
216
+ fileInfo , err : = os .Stat (cPath )
221
217
if err != nil {
222
218
Fail (errors .New (errConfigFileAssert ))
223
219
}
@@ -495,7 +491,7 @@ func readPage(filePath string) *Page {
495
491
Fail (err )
496
492
}
497
493
498
- err = frontmatter .Unmarshal (([] byte )( data ) , page )
494
+ err = frontmatter .Unmarshal (data , page )
499
495
if err != nil {
500
496
Fail (err )
501
497
}
Original file line number Diff line number Diff line change @@ -22,9 +22,9 @@ func Test_Page_CreatedAt(t *testing.T) {
22
22
23
23
actual := page .CreatedAt ()
24
24
25
- assert .Equal (t , 2020 , int ( actual .Year () ))
25
+ assert .Equal (t , 2020 , actual .Year ())
26
26
assert .Equal (t , 5 , int (actual .Month ()))
27
- assert .Equal (t , 7 , int ( actual .Day () ))
27
+ assert .Equal (t , 7 , actual .Day ())
28
28
}
29
29
30
30
func Test_Page_CreatedMonth (t * testing.T ) {
You can’t perform that action at this time.
0 commit comments