From a1d7b08ce1d6d1c66e94f7f58af846b1727def9b Mon Sep 17 00:00:00 2001 From: jholdstock Date: Wed, 7 Aug 2024 09:04:54 +0100 Subject: [PATCH] main: Unexport everything. dcrpool is a standalone application and none of the code in its main package is designed to be reused or imported by other projects. --- config.go | 8 ++++---- dcrpool.go | 6 +++--- params.go | 26 +++++++++++++------------- version.go | 52 ++++++++++++++++++++++++++-------------------------- 4 files changed, 46 insertions(+), 46 deletions(-) diff --git a/config.go b/config.go index 17b48959..bdf1363b 100644 --- a/config.go +++ b/config.go @@ -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. @@ -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) } @@ -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) diff --git a/dcrpool.go b/dcrpool.go index 38778dac..73c45ce7 100644 --- a/dcrpool.go +++ b/dcrpool.go @@ -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. @@ -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, @@ -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 diff --git a/params.go b/params.go index 54669e16..0b4ffb8b 100644 --- a/params.go +++ b/params.go @@ -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. @@ -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: "...", } diff --git a/version.go b/version.go index 7578036f..41eff734 100644 --- a/version.go +++ b/version.go @@ -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. @@ -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 } } }