Skip to content

Commit 9cf9dde

Browse files
authored
Update go, build tools and license. (#197)
* LICENSE: 2025 * Update build tools (incl. go 1.25). * Bump dcrutil version.
1 parent 4dcfa00 commit 9cf9dde

9 files changed

Lines changed: 36 additions & 30 deletions

File tree

.github/workflows/docker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jobs:
55
build:
66
runs-on: ubuntu-latest
77
steps:
8-
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b #v4.1.4
8+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0
99
- name: Build the Docker image
1010
run: docker build -t decred/dcrwebapi:$(date +%s) .
1111

.github/workflows/go.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ jobs:
99
runs-on: ubuntu-latest
1010
strategy:
1111
matrix:
12-
go: ["1.21", "1.22"]
12+
go: ["1.24", "1.25"]
1313
steps:
1414
- name: Set up Go
15-
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 #v5.0.1
15+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 #v5.5.0
1616
with:
1717
go-version: ${{ matrix.go }}
1818
- name: Check out source
19-
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b #v4.1.4
19+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0
2020
- name: Install Linters
21-
run: "curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.58.1"
21+
run: "curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.4.0"
2222
- name: Build
2323
run: go build ./...
2424
- name: Test

.golangci.yml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,32 @@
1+
version: "2"
12
run:
2-
deadline: 10m
3+
timeout: 10m
34

45
linters:
5-
disable-all: true
6+
default: none
67
enable:
78
- asciicheck
89
- bidichk
910
- durationcheck
1011
- exhaustive
11-
- exportloopref
1212
- goconst
13-
- gofmt
14-
- goimports
15-
- gosimple
1613
- govet
1714
- ineffassign
1815
- misspell
1916
- nilerr
2017
- revive
2118
- staticcheck
2219
- tparallel
23-
- typecheck
2420
- unconvert
2521
- unparam
2622
- unused
27-
- vetshadow
23+
- usestdlibvars
24+
- usetesting
25+
exclusions:
26+
presets:
27+
- comments
28+
formatters:
29+
enable:
30+
- gofmt
31+
- goimports
32+

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# build
2-
FROM golang:1.22-alpine AS builder
2+
FROM golang:1.25-alpine AS builder
33

44
WORKDIR $GOPATH/src/github.com/decred/dcrwebapi
55
COPY . .

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ISC License
22

3-
Copyright (c) 2017-2024 The Decred developers
3+
Copyright (c) 2017-2025 The Decred developers
44

55
Permission to use, copy, modify, and distribute this software for any
66
purpose with or without fee is hereby granted, provided that the above

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/decred/dcrwebapi
33
go 1.18
44

55
require (
6-
github.com/decred/dcrd/dcrutil/v4 v4.0.1
6+
github.com/decred/dcrd/dcrutil/v4 v4.0.2
77
github.com/decred/dcrdata/v6 v6.0.0
88
github.com/gorilla/handlers v1.5.2
99
)
@@ -16,7 +16,7 @@ require (
1616
github.com/decred/dcrd/blockchain/stake/v3 v3.0.1 // indirect
1717
github.com/decred/dcrd/blockchain/standalone/v2 v2.2.0 // indirect
1818
github.com/decred/dcrd/chaincfg/chainhash v1.0.4 // indirect
19-
github.com/decred/dcrd/chaincfg/v3 v3.2.0 // indirect
19+
github.com/decred/dcrd/chaincfg/v3 v3.2.1 // indirect
2020
github.com/decred/dcrd/crypto/blake256 v1.0.1 // indirect
2121
github.com/decred/dcrd/crypto/ripemd160 v1.0.2 // indirect
2222
github.com/decred/dcrd/database/v2 v2.0.3 // indirect
@@ -28,8 +28,8 @@ require (
2828
github.com/decred/dcrd/dcrutil/v3 v3.0.1 // indirect
2929
github.com/decred/dcrd/rpc/jsonrpc/types/v2 v2.3.1 // indirect
3030
github.com/decred/dcrd/txscript/v3 v3.0.1 // indirect
31-
github.com/decred/dcrd/txscript/v4 v4.1.0 // indirect
32-
github.com/decred/dcrd/wire v1.6.0 // indirect
31+
github.com/decred/dcrd/txscript/v4 v4.1.1 // indirect
32+
github.com/decred/dcrd/wire v1.7.0 // indirect
3333
github.com/decred/slog v1.2.0 // indirect
3434
github.com/felixge/httpsnoop v1.0.4 // indirect
3535
github.com/golang/snappy v0.0.4 // indirect

go.sum

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ github.com/decred/dcrd/chaincfg/chainhash v1.0.2/go.mod h1:BpbrGgrPTr3YJYRN3Bm+D
3939
github.com/decred/dcrd/chaincfg/chainhash v1.0.4 h1:zRCv6tdncLfLTKYqu7hrXvs7hW+8FO/NvwoFvGsrluU=
4040
github.com/decred/dcrd/chaincfg/chainhash v1.0.4/go.mod h1:hA86XxlBWwHivMvxzXTSD0ZCG/LoYsFdWnCekkTMCqY=
4141
github.com/decred/dcrd/chaincfg/v3 v3.0.0/go.mod h1:EspyubQ7D2w6tjP7rBGDIE7OTbuMgBjR2F2kZFnh31A=
42-
github.com/decred/dcrd/chaincfg/v3 v3.2.0 h1:6WxA92AGBkycEuWvxtZMvA76FbzbkDRoK8OGbsR2muk=
43-
github.com/decred/dcrd/chaincfg/v3 v3.2.0/go.mod h1:2rHW1TKyFmwZTVBLoU/Cmf0oxcpBjUEegbSlBfrsriI=
42+
github.com/decred/dcrd/chaincfg/v3 v3.2.1 h1:x9zKJaU24WAKbxAR1UyFKHlM3oJgP0H9LodokM4X5lM=
43+
github.com/decred/dcrd/chaincfg/v3 v3.2.1/go.mod h1:SDCWDtY7BLj0leXc9FuoA1YjSVKyCIBVAyxwZn6+sXc=
4444
github.com/decred/dcrd/connmgr/v3 v3.0.0/go.mod h1:cPI43Aggp1lOhrVG75eJ3c3BwuFx0NhT77FK34ky+ak=
4545
github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc=
4646
github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y=
@@ -68,8 +68,8 @@ github.com/decred/dcrd/dcrjson/v3 v3.1.1/go.mod h1:lACNzZjn7po2erViTnXtBfdvSzK7E
6868
github.com/decred/dcrd/dcrutil/v3 v3.0.0/go.mod h1:iVsjcqVzLmYFGCZLet2H7Nq+7imV9tYcuY+0lC2mNsY=
6969
github.com/decred/dcrd/dcrutil/v3 v3.0.1 h1:F6FjaGMzs/1adL0Ld3T1tGAyKwAWfsNYoCt4h620zJQ=
7070
github.com/decred/dcrd/dcrutil/v3 v3.0.1/go.mod h1:XfZj8SjOoOYiFuOK6hA9NEwKpH907XOFdlw9UxlJf28=
71-
github.com/decred/dcrd/dcrutil/v4 v4.0.1 h1:E+d2TNbpOj0f1L9RqkZkEm1QolFjajvkzxWC5WOPf1s=
72-
github.com/decred/dcrd/dcrutil/v4 v4.0.1/go.mod h1:7EXyHYj8FEqY+WzMuRkF0nh32ueLqhutZDoW4eQ+KRc=
71+
github.com/decred/dcrd/dcrutil/v4 v4.0.2 h1:eIl3E6gGln54qE8nk5o5lLtjh2/9C2Rz63OpD662h+8=
72+
github.com/decred/dcrd/dcrutil/v4 v4.0.2/go.mod h1:iS3JB1ac3R3FgfpTF1kBD+SPNet8TmiW3Br+/Jc5MC8=
7373
github.com/decred/dcrd/gcs/v2 v2.1.0/go.mod h1:MbnJOINFcp42NMRAQ+CjX/xGz+53AwNgMzKZhwBibdM=
7474
github.com/decred/dcrd/hdkeychain/v3 v3.0.0/go.mod h1:Vz7PJSlLzhqmOR2lmjGD9JqAZgmUnM8P6r8hg7U4Zho=
7575
github.com/decred/dcrd/rpc/jsonrpc/types/v2 v2.3.0/go.mod h1:krn89ZOgSa8yc7sA4WpDK95p61NnjNWFkNlMnGrKbMc=
@@ -79,12 +79,12 @@ github.com/decred/dcrd/rpcclient/v6 v6.0.2/go.mod h1:t6ECC72j2xWQ323poL85IFNq0EU
7979
github.com/decred/dcrd/txscript/v3 v3.0.0/go.mod h1:pdvnlD4KGdDoc09cvWRJ8EoRQUaiUz41uDevOWuEfII=
8080
github.com/decred/dcrd/txscript/v3 v3.0.1 h1:343cSGjRR0Oel6kjLhcCQq37W2G4DwnkXkAeUmWcEv4=
8181
github.com/decred/dcrd/txscript/v3 v3.0.1/go.mod h1:NbIL3qM6U6NS3TKPf5zAx3cDsC3QsUJfSNOLxgcCMhY=
82-
github.com/decred/dcrd/txscript/v4 v4.1.0 h1:uEdcibIOl6BuWj3AqmXZ9xIK/qbo6lHY9aNk29FtkrU=
83-
github.com/decred/dcrd/txscript/v4 v4.1.0/go.mod h1:OVguPtPc4YMkgssxzP8B6XEMf/J3MB6S1JKpxgGQqi0=
82+
github.com/decred/dcrd/txscript/v4 v4.1.1 h1:R4M2+jMujgQA91899SkL0cW66d6DC76Gx+1W1oEHjc0=
83+
github.com/decred/dcrd/txscript/v4 v4.1.1/go.mod h1:7ybmJoI+b6dxvQ+0aXdZpkyrj0PbnylJCzFxD1g8+/A=
8484
github.com/decred/dcrd/wire v1.3.0/go.mod h1:fnKGlUY2IBuqnpxx5dYRU5Oiq392OBqAuVjRVSkIoXM=
8585
github.com/decred/dcrd/wire v1.4.0/go.mod h1:WxC/0K+cCAnBh+SKsRjIX9YPgvrjhmE+6pZlel1G7Ro=
86-
github.com/decred/dcrd/wire v1.6.0 h1:YOGwPHk4nzGr6OIwUGb8crJYWDiVLpuMxfDBCCF7s/o=
87-
github.com/decred/dcrd/wire v1.6.0/go.mod h1:XQ8Xv/pN/3xaDcb7sH8FBLS9cdgVctT7HpBKKGsIACk=
86+
github.com/decred/dcrd/wire v1.7.0 h1:5JHiDjEQeS4XUl4PfnTZYLwAD/E/+LwBmPRec/fP76o=
87+
github.com/decred/dcrd/wire v1.7.0/go.mod h1:lAqrzV0SU4kyV6INLEJgDtUjJaTaVKrbF4LHtaYl+zU=
8888
github.com/decred/dcrdata/v6 v6.0.0 h1:eNe2h7XCITLBM4FfBVd57VwqGYpCLJrnev38YzwJ9qw=
8989
github.com/decred/dcrdata/v6 v6.0.0/go.mod h1:3dzYsjv4i8/H7jAWRmIq3yXW5Wa/1Hv3xJV1oGDIgfk=
9090
github.com/decred/go-socks v1.1.0/go.mod h1:sDhHqkZH0X4JjSa02oYOGhcGHYp12FsY1jQ/meV8md0=
@@ -224,6 +224,7 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
224224
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
225225
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
226226
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
227+
golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
227228
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
228229
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
229230
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=

main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2017-2018 The Decred developers
1+
// Copyright (c) 2017-2025 The Decred developers
22
// Use of this source code is governed by an ISC
33
// license that can be found in the LICENSE file.
44

@@ -21,7 +21,7 @@ func main() {
2121
log.Println("dcrwebapi starting on", defaultPort)
2222

2323
origins := handlers.AllowedOrigins([]string{"*"})
24-
methods := handlers.AllowedMethods([]string{"GET", "OPTIONS"})
24+
methods := handlers.AllowedMethods([]string{http.MethodGet, http.MethodOptions})
2525

2626
log.Fatal(http.ListenAndServe(defaultPort,
2727
handlers.CORS(origins, methods)(service.Router)))

service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ func NewService() *Service {
168168
// getHTTP will use the services HTTP client to send a GET request to the
169169
// provided URL. Returns the response body, or an error.
170170
func (service *Service) getHTTP(url string) ([]byte, error) {
171-
req, err := http.NewRequest("GET", url, nil)
171+
req, err := http.NewRequest(http.MethodGet, url, nil)
172172
if err != nil {
173173
return nil, fmt.Errorf("%v: failed to create request: %v",
174174
url, err)

0 commit comments

Comments
 (0)