Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go: ["1.23", "1.24"]
go: ["1.24", "1.25"]
steps:
- name: Set up Go
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 #5.3.0
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 #6.0.0
with:
go-version: ${{ matrix.go }}
- name: Check out source
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0
- name: Install linters
run: "curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.64.5"
run: "curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.6.1"
- name: Build
run: go build ./...
- name: Lint
Expand Down
35 changes: 28 additions & 7 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,47 @@
version: "2"
run:
deadline: 10m

timeout: 10m
linters:
disable-all: true
default: none
enable:
- asciicheck
- bidichk
- bodyclose
- containedctx
- copyloopvar
- dupword
- durationcheck
- errchkjson
- gofmt
- goimports
- gosimple
- errorlint
- exhaustive
- fatcontext
- goconst
- godot
- govet
- grouper
- ineffassign
- makezero
- mirror
- misspell
- nilerr
- nilnil
- nosprintfhostport
- prealloc
- predeclared
- reassign
- rowserrcheck
- staticcheck
- tparallel
- typecheck
- unconvert
- unparam
- unused
- usestdlibvars
- usetesting
settings:
staticcheck:
checks:
- S1*
formatters:
enable:
- gofmt
- goimports
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Copyright (c) 2013-2017 The btcsuite developers
Copyright (c) 2015-2020 The Decred developers
Copyright (c) 2015-2025 The Decred developers

Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ changes may be written to a config file in a platform-specific location:

## Build and installation

- **Install Go 1.23 or higher version**
- **Install Go 1.24 or higher version**

Installation instructions can be found here: https://golang.org/doc/install.
Ensure Go was installed properly and is a supported version:
Expand Down
8 changes: 4 additions & 4 deletions dcrctl.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2013-2015 The btcsuite developers
// Copyright (c) 2015-2023 The Decred developers
// Copyright (c) 2015-2025 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

Expand Down Expand Up @@ -40,9 +40,9 @@ func commandUsage(method interface{}) {
fmt.Fprintf(os.Stderr, " %s\n", usage)
}

// usage displays the general usage when the help flag is not displayed and
// and an invalid command was specified. The commandUsage function is used
// instead when a valid command was specified.
// usage displays the general usage when the help flag is not displayed and an
// invalid command was specified. The commandUsage function is used instead
// when a valid command was specified.
func usage(errorMessage string) {
appName := filepath.Base(os.Args[0])
appName = strings.TrimSuffix(appName, filepath.Ext(appName))
Expand Down
8 changes: 4 additions & 4 deletions httpclient.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2013-2015 The btcsuite developers
// Copyright (c) 2015-2023 The Decred developers
// Copyright (c) 2015-2025 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

Expand Down Expand Up @@ -58,7 +58,7 @@ func newHTTPClient(cfg *config) (*http.Client, error) {
}
keypair, err := tls.LoadX509KeyPair(cfg.ClientCert, cfg.ClientKey)
if err != nil {
return nil, fmt.Errorf("read client keypair: %v", err)
return nil, fmt.Errorf("read client keypair: %w", err)
}

tlsConfig.Certificates = []tls.Certificate{keypair}
Expand All @@ -73,7 +73,7 @@ func newHTTPClient(cfg *config) (*http.Client, error) {

pool := x509.NewCertPool()
if ok := pool.AppendCertsFromPEM(pem); !ok {
return nil, fmt.Errorf("invalid certificate file: %v",
return nil, fmt.Errorf("invalid certificate file: %s",
cfg.RPCCert)
}
tlsConfig.RootCAs = pool
Expand Down Expand Up @@ -106,7 +106,7 @@ func sendPostRequest(marshalledJSON []byte, cfg *config) ([]byte, error) {
fmt.Println(string(marshalledJSON))
}
bodyReader := bytes.NewReader(marshalledJSON)
httpRequest, err := http.NewRequest("POST", url, bodyReader)
httpRequest, err := http.NewRequest(http.MethodPost, url, bodyReader)
if err != nil {
return nil, err
}
Expand Down
28 changes: 27 additions & 1 deletion version.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2013-2014 The btcsuite developers
// Copyright (c) 2015-2022 The Decred developers
// Copyright (c) 2015-2025 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

Expand All @@ -8,6 +8,7 @@ package main
import (
"fmt"
"regexp"
"runtime/debug"
"strconv"
"strings"
)
Expand Down Expand Up @@ -129,6 +130,31 @@ func parseSemVer(s string) (uint32, uint32, uint32, string, string, error) {
return major, minor, patch, preRel, build, nil
}

// vcsCommitID attempts to return the version control system short commit hash
// that was used to build the binary. It currently only detects git commits.
func vcsCommitID() string {
bi, ok := debug.ReadBuildInfo()
if !ok {
return ""
}
var vcs, revision string
for _, bs := range bi.Settings {
switch bs.Key {
case "vcs":
vcs = bs.Value
case "vcs.revision":
revision = bs.Value
}
}
if vcs == "" {
return ""
}
if vcs == "git" && len(revision) > 9 {
revision = revision[:9]
}
return revision
}

func init() {
var err error
Major, Minor, Patch, PreRelease, BuildMetadata, err = parseSemVer(Version)
Expand Down
35 changes: 0 additions & 35 deletions version_buildinfo.go

This file was deleted.

14 changes: 0 additions & 14 deletions version_nobuildinfo.go

This file was deleted.

Loading