Skip to content

Commit

Permalink
main: Unexport everything.
Browse files Browse the repository at this point in the history
dcrpool is a standalone application and none of the code in its main
package is designed to be reused or imported by other projects.
  • Loading branch information
jholdstock committed Aug 7, 2024
1 parent 80ab27d commit a1d7b08
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 46 deletions.
8 changes: 4 additions & 4 deletions config.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2019-2023 The Decred developers
// Copyright (c) 2019-2024 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 @@ -393,7 +393,7 @@ func loadConfig(appName string) (*config, []string, error) {
// Show the version and exit if the version flag was specified.
if preCfg.ShowVersion {
fmt.Printf("%s version %s (Go version %s %s/%s)\n", appName,
Version, runtime.Version(), runtime.GOOS, runtime.GOARCH)
version, runtime.Version(), runtime.GOOS, runtime.GOARCH)
os.Exit(0)
}

Expand Down Expand Up @@ -581,8 +581,8 @@ func loadConfig(appName string) (*config, []string, error) {
}

// Add default ports for the active network if there are no ports specified.
cfg.DcrdRPCHost = normalizeAddress(cfg.DcrdRPCHost, cfg.net.DcrdRPCServerPort)
cfg.WalletGRPCHost = normalizeAddress(cfg.WalletGRPCHost, cfg.net.WalletGRPCServerPort)
cfg.DcrdRPCHost = normalizeAddress(cfg.DcrdRPCHost, cfg.net.dcrdRPCServerPort)
cfg.WalletGRPCHost = normalizeAddress(cfg.WalletGRPCHost, cfg.net.walletGRPCServerPort)

cfg.MinerListen = normalizeAddress(cfg.MinerListen, defaultMinerPort)
cfg.GUIListen = normalizeAddress(cfg.GUIListen, defaultGUIPort)
Expand Down
6 changes: 3 additions & 3 deletions dcrpool.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2019-2023 The Decred developers
// Copyright (c) 2019-2024 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 @@ -82,7 +82,7 @@ func newGUI(cfg *config, hub *pool.Hub) (*gui.GUI, error) {
TLSCertFile: cfg.GUITLSCert,
TLSKeyFile: cfg.GUITLSKey,
ActiveNetName: cfg.net.Params.Name,
BlockExplorerURL: cfg.net.BlockExplorerURL,
BlockExplorerURL: cfg.net.blockExplorerURL,
PaymentMethod: cfg.PaymentMethod,
Designation: cfg.Designation,
PoolFee: cfg.PoolFee,
Expand Down Expand Up @@ -140,7 +140,7 @@ func realMain() error {

// Show version and home dir at startup.
mpLog.Infof("%s version %s (Go version %s %s/%s)", appName,
Version, runtime.Version(), runtime.GOOS, runtime.GOARCH)
version, runtime.Version(), runtime.GOOS, runtime.GOARCH)
mpLog.Infof("Home dir: %s", cfg.HomeDir)

var db pool.Database
Expand Down
26 changes: 13 additions & 13 deletions params.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2020-2021 The Decred developers
// Copyright (c) 2020-2024 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

Expand All @@ -10,28 +10,28 @@ import (

type params struct {
*chaincfg.Params
DcrdRPCServerPort string
WalletGRPCServerPort string
BlockExplorerURL string
dcrdRPCServerPort string
walletGRPCServerPort string
blockExplorerURL string
}

var mainNetParams = params{
Params: chaincfg.MainNetParams(),
DcrdRPCServerPort: "9109",
WalletGRPCServerPort: "9111",
BlockExplorerURL: "https://dcrdata.decred.org",
dcrdRPCServerPort: "9109",
walletGRPCServerPort: "9111",
blockExplorerURL: "https://dcrdata.decred.org",
}

var testNet3Params = params{
Params: chaincfg.TestNet3Params(),
DcrdRPCServerPort: "19109",
WalletGRPCServerPort: "19111",
BlockExplorerURL: "https://testnet.dcrdata.org",
dcrdRPCServerPort: "19109",
walletGRPCServerPort: "19111",
blockExplorerURL: "https://testnet.dcrdata.org",
}

var simNetParams = params{
Params: chaincfg.SimNetParams(),
DcrdRPCServerPort: "19556",
WalletGRPCServerPort: "19558",
BlockExplorerURL: "...",
dcrdRPCServerPort: "19556",
walletGRPCServerPort: "19558",
blockExplorerURL: "...",
}
52 changes: 26 additions & 26 deletions 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-2023 The Decred developers
// Copyright (c) 2015-2024 The Decred developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.

Expand All @@ -18,60 +18,60 @@ var (
//
// The expected process for setting the version in releases is as follows:
// - Create a release branch of the form 'release-vMAJOR.MINOR'
// - Modify the Version variable below on that branch to:
// - Modify the version variable below on that branch to:
// - Remove the pre-release portion
// - Set the build metadata to 'release.local'
// - Update the Version variable below on the master branch to the next
// - Update the version variable below on the master branch to the next
// expected version while retaining a pre-release of 'pre'
//
// These steps ensure that building from source produces versions that are
// distinct from reproducible builds that override the Version via linker
// distinct from reproducible builds that override the version via linker
// flags.

// Version is the application version per the semantic versioning 2.0.0 spec
// version is the application version per the semantic versioning 2.0.0 spec
// (https://semver.org/).
//
// It is defined as a variable so it can be overridden during the build
// process with:
// '-ldflags "-X main.Version=fullsemver"'
// '-ldflags "-X main.version=fullsemver"'
// if needed.
//
// It MUST be a full semantic version per the semantic versioning spec or
// the app will panic at runtime. Of particular note is the pre-release
// and build metadata portions MUST only contain characters from
// semanticAlphabet.
Version = "1.3.0-pre"
version = "1.3.0-pre"

// NOTE: The following values are set via init by parsing the above Version
// NOTE: The following values are set via init by parsing the above version
// string.

// These fields are the individual semantic version components that define
// the application version.
Major uint32
Minor uint32
Patch uint32
PreRelease string
BuildMetadata string
major uint32
minor uint32
patch uint32
preRelease string
buildMetadata string
)

func init() {
parsedSemVer, err := semver.Parse(Version)
parsedSemVer, err := semver.Parse(version)
if err != nil {
panic(err)
}
Major = parsedSemVer.Major
Minor = parsedSemVer.Minor
Patch = parsedSemVer.Patch
PreRelease = parsedSemVer.PreRelease
BuildMetadata = parsedSemVer.BuildMetadata
if BuildMetadata == "" {
BuildMetadata = vcsCommitID()
if BuildMetadata != "" {
Version = fmt.Sprintf("%d.%d.%d", Major, Minor, Patch)
if PreRelease != "" {
Version += "-" + PreRelease
major = parsedSemVer.Major
minor = parsedSemVer.Minor
patch = parsedSemVer.Patch
preRelease = parsedSemVer.PreRelease
buildMetadata = parsedSemVer.BuildMetadata
if buildMetadata == "" {
buildMetadata = vcsCommitID()
if buildMetadata != "" {
version = fmt.Sprintf("%d.%d.%d", major, minor, patch)
if preRelease != "" {
version += "-" + preRelease
}
Version += "+" + BuildMetadata
version += "+" + buildMetadata
}
}
}

0 comments on commit a1d7b08

Please sign in to comment.