瀏覽代碼

Simplified build versioning

* Removed static version number
* Add README documentation recommending BUILD* versioning info
Rod Hynes 10 年之前
父節點
當前提交
9e0880485b
共有 4 個文件被更改,包括 15 次插入9 次删除
  1. 15 2
      README.md
  2. 0 1
      psiphon/config.go
  3. 0 1
      psiphon/controller.go
  4. 0 5
      psiphon/notice.go

+ 15 - 2
README.md

@@ -19,9 +19,22 @@ Setup
 --------------------------------------------------------------------------------
 
 * Go 1.4 (or higher) is required.
-* In this repository, run `go build` to make the `psiphon-tunnel-core` binary.
-* Note that the `psiphon` package is imported using the absolute path `github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon`; without further local configuration, `go` will use this version of the code and not the local copy in the repository.
 * This project builds and runs on recent versions of Windows, Linux, and Mac OS X.
+* Note that the `psiphon` package is imported using the absolute path `github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon`; without further local configuration, `go` will use this version of the code and not the local copy in the repository.
+* In this repository, run `go build` to make the `psiphon-tunnel-core` binary.
+  * Build versioning info may be configured as follows, and passed to `go build` in the `-ldflags` argument:
+
+    ```
+    BUILDDATE=$(date --iso-8601=seconds)
+    BUILDREPO=$(git config --get remote.origin.url)
+    BUILDREV=$(git rev-parse HEAD)
+    LDFLAGS="\
+    -X github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon.buildDate $BUILDDATE \
+    -X github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon.buildRepo $BUILDREPO \
+    -X github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon.buildRev $BUILDREV \
+    "
+    ```
+
 * Run `./psiphon-tunnel-core --config psiphon.config` where the config file looks like this:
 
 <!--BEGIN-SAMPLE-CONFIG-->

+ 0 - 1
psiphon/config.go

@@ -29,7 +29,6 @@ import (
 // TODO: allow all params to be configured
 
 const (
-	VERSION                                      = "0.0.9"
 	DATA_STORE_FILENAME                          = "psiphon.db"
 	CONNECTION_WORKER_POOL_SIZE                  = 10
 	TUNNEL_POOL_SIZE                             = 1

+ 0 - 1
psiphon/controller.go

@@ -123,7 +123,6 @@ func NewController(config *Config) (controller *Controller, err error) {
 // - a local HTTP proxy that port forwards through the pool of tunnels
 func (controller *Controller) Run(shutdownBroadcast <-chan struct{}) {
 	NoticeBuildInfo()
-	NoticeCoreVersion(VERSION)
 	ReportAvailableRegions()
 
 	// Start components

+ 0 - 5
psiphon/notice.go

@@ -99,11 +99,6 @@ func NoticeError(format string, args ...interface{}) {
 	outputNotice("Error", true, "message", fmt.Sprintf(format, args...))
 }
 
-// NoticeCoreVersion is the version string of the core
-func NoticeCoreVersion(version string) {
-	outputNotice("CoreVersion", false, "version", version)
-}
-
 // NoticeCandidateServers is how many possible servers are available for the selected region and protocol
 func NoticeCandidateServers(region, protocol string, count int) {
 	outputNotice("CandidateServers", false, "region", region, "protocol", protocol, "count", count)