move version.go to top level package
License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
Łukasz Magiera committed
Jul 25, 2018 at 10:27 UTC
ffc74391d5b14af149b74e11fb6f37d0812ad404
10 files changed
+25
-21
core/commands/sysdiag.go
+3
-3
@@ -5,8 +5,8 @@ import (
5
"path"
6
"runtime"
7
8
+ version "github.com/ipfs/go-ipfs"
9
cmds "github.com/ipfs/go-ipfs/commands"
9
- "github.com/ipfs/go-ipfs/repo"
10
11
manet "gx/ipfs/QmV6FjemM1K8oXjrvuq3wuVWWoU2TLDPmNnKrxHzY3v6Ai/go-multiaddr-net"
12
sysi "gx/ipfs/QmZRjKbHa6DenStpQJFiaPcEwkZqrx7TH6xTf342LDU3qM/go-sysinfo"
@@ -57,8 +57,8 @@ Prints out information about your computer to aid in easier debugging.
57
return
58
}
59
60
- info["ipfs_version"] = repo.CurrentVersionNumber
61
- info["ipfs_commit"] = repo.CurrentCommit
60
+ info["ipfs_version"] = version.CurrentVersionNumber
61
+ info["ipfs_commit"] = version.CurrentCommit
62
res.SetOutput(info)
63
},
64
}
core/commands/version.go
+3
-3
@@ -6,9 +6,9 @@ import (
6
"runtime"
7
"strings"
8
9
+ version "github.com/ipfs/go-ipfs"
10
cmds "github.com/ipfs/go-ipfs/commands"
11
e "github.com/ipfs/go-ipfs/core/commands/e"
11
- repo "github.com/ipfs/go-ipfs/repo"
12
fsrepo "github.com/ipfs/go-ipfs/repo/fsrepo"
13
14
"gx/ipfs/QmdE4gMduCKCGAcczM2F5ioYDfdeKuPix138wrES1YSr7f/go-ipfs-cmdkit"
@@ -36,8 +36,8 @@ var VersionCmd = &cmds.Command{
36
},
37
Run: func(req cmds.Request, res cmds.Response) {
38
res.SetOutput(&VersionOutput{
39
- Version: repo.CurrentVersionNumber,
40
- Commit: repo.CurrentCommit,
39
+ Version: version.CurrentVersionNumber,
40
+ Commit: version.CurrentCommit,
41
Repo: fmt.Sprint(fsrepo.RepoVersion),
42
System: runtime.GOARCH + "/" + runtime.GOOS, //TODO: Precise version here
43
Golang: runtime.Version(),
core/core.go
+4
-1
@@ -20,6 +20,7 @@ import (
20
"strings"
21
"time"
22
23
+ version "github.com/ipfs/go-ipfs"
24
rp "github.com/ipfs/go-ipfs/exchange/reprovide"
25
filestore "github.com/ipfs/go-ipfs/filestore"
26
mount "github.com/ipfs/go-ipfs/fuse/mount"
@@ -44,6 +45,8 @@ import (
45
logging "gx/ipfs/QmRREK2CAZ5Re2Bd9zZFG6FeYDppUWt5cMgsoUEp3ktgSr/go-log"
46
floodsub "gx/ipfs/QmRXefkwjreRT6XfYh3Ag4hsVnWBbpcUicGJPcg8TWbhBK/go-libp2p-floodsub"
47
goprocess "gx/ipfs/QmSF8fPo3jgVBAy8fpdjjYqgG87dkJgUprRBHRd2tmfgpP/goprocess"
48
+ bitswap "gx/ipfs/QmNQQEYL3Vpj4beteqyeRpVpivuX1wBP6Q5GZMdBPPTV3S/go-bitswap"
49
+ bsnet "gx/ipfs/QmNQQEYL3Vpj4beteqyeRpVpivuX1wBP6Q5GZMdBPPTV3S/go-bitswap/network"
50
mamask "gx/ipfs/QmSMZwvs3n4GBikZ7hKzT17c3bk65FmyZo2JqtJ16swqCv/multiaddr-filter"
51
mafilter "gx/ipfs/QmSW4uNHbvQia8iZDXzbwjiyHQtnyo9aFqfQAMasj3TJ6Y/go-maddr-filter"
52
libp2p "gx/ipfs/QmUDzeFgYrRmHL2hUB6NZmqcBVQtUzETwmFRUc9onfSSHr/go-libp2p"
@@ -94,7 +97,7 @@ const (
97
)
98
99
func init() {
97
- identify.ClientVersion = "go-ipfs/" + repo.CurrentVersionNumber + "/" + repo.CurrentCommit
100
+ identify.ClientVersion = "go-ipfs/" + version.CurrentVersionNumber + "/" + version.CurrentCommit
101
}
102
103
// IpfsNode is IPFS Core module. It represents an IPFS instance.
core/corehttp/commands.go
+4
-4
@@ -9,10 +9,10 @@ import (
9
"strconv"
10
"strings"
11
12
+ version "github.com/ipfs/go-ipfs"
13
oldcmds "github.com/ipfs/go-ipfs/commands"
13
- core "github.com/ipfs/go-ipfs/core"
14
+ "github.com/ipfs/go-ipfs/core"
15
corecommands "github.com/ipfs/go-ipfs/core/commands"
15
- repo "github.com/ipfs/go-ipfs/repo"
16
17
path "gx/ipfs/QmPqCBrmkm7jNfYi7xFS7mUZsrN6DEumBMrxLnL7axNJx1/go-path"
18
cmds "gx/ipfs/QmbWGdyATxHpmbDC2z7zMNnmPmiHCRXS5f2vyxBfgz8bVb/go-ipfs-cmds"
@@ -78,7 +78,7 @@ func addHeadersFromConfig(c *cmdsHttp.ServerConfig, nc *config.Config) {
78
for h, v := range nc.API.HTTPHeaders {
79
c.Headers[h] = v
80
}
81
- c.Headers["Server"] = []string{"go-ipfs/" + repo.CurrentVersionNumber}
81
+ c.Headers["Server"] = []string{"go-ipfs/" + version.CurrentVersionNumber}
82
}
83
84
func addCORSDefaults(c *cmdsHttp.ServerConfig) {
@@ -153,7 +153,7 @@ func CommandsROOption(cctx oldcmds.Context) ServeOption {
153
154
// CheckVersionOption returns a ServeOption that checks whether the client ipfs version matches. Does nothing when the user agent string does not contain `/go-ipfs/`
155
func CheckVersionOption() ServeOption {
156
- daemonVersion := repo.ApiVersion
156
+ daemonVersion := version.ApiVersion
157
158
return ServeOption(func(n *core.IpfsNode, l net.Listener, parent *http.ServeMux) (*http.ServeMux, error) {
159
mux := http.NewServeMux()
core/corehttp/gateway.go
+2
-2
@@ -5,9 +5,9 @@ import (
5
"net"
6
"net/http"
7
8
+ version "github.com/ipfs/go-ipfs"
9
core "github.com/ipfs/go-ipfs/core"
10
coreapi "github.com/ipfs/go-ipfs/core/coreapi"
10
- repo "github.com/ipfs/go-ipfs/repo"
11
12
id "gx/ipfs/QmUDzeFgYrRmHL2hUB6NZmqcBVQtUzETwmFRUc9onfSSHr/go-libp2p/p2p/protocol/identify"
13
)
@@ -41,7 +41,7 @@ func GatewayOption(writable bool, paths ...string) ServeOption {
41
func VersionOption() ServeOption {
42
return func(_ *core.IpfsNode, _ net.Listener, mux *http.ServeMux) (*http.ServeMux, error) {
43
mux.HandleFunc("/version", func(w http.ResponseWriter, r *http.Request) {
44
- fmt.Fprintf(w, "Commit: %s\n", repo.CurrentCommit)
44
+ fmt.Fprintf(w, "Commit: %s\n", version.CurrentCommit)
45
fmt.Fprintf(w, "Client Version: %s\n", id.ClientVersion)
46
fmt.Fprintf(w, "Protocol Version: %s\n", id.LibP2PVersion)
47
})
core/corehttp/gateway_test.go
+2
-1
@@ -11,6 +11,7 @@ import (
11
"testing"
12
"time"
13
14
+ version "github.com/ipfs/go-ipfs"
15
core "github.com/ipfs/go-ipfs/core"
16
coreunix "github.com/ipfs/go-ipfs/core/coreunix"
17
namesys "github.com/ipfs/go-ipfs/namesys"
@@ -545,7 +546,7 @@ func TestGoGetSupport(t *testing.T) {
546
}
547
548
func TestVersion(t *testing.T) {
548
- repo.CurrentCommit = "theshortcommithash"
549
+ version.CurrentCommit = "theshortcommithash"
550
551
ns := mockNamesys{}
552
ts, _ := newTestServerAndNode(t, ns)
core/corehttp/option_test.go
+3
-3
@@ -7,7 +7,7 @@ import (
7
"net/http/httptest"
8
"testing"
9
10
- "github.com/ipfs/go-ipfs/repo"
10
+ version "github.com/ipfs/go-ipfs"
11
)
12
13
type testcasecheckversion struct {
@@ -20,7 +20,7 @@ type testcasecheckversion struct {
20
21
func (tc testcasecheckversion) body() string {
22
if !tc.shouldHandle && tc.responseBody == "" {
23
- return fmt.Sprintf("%s (%s != %s)\n", errAPIVersionMismatch, repo.ApiVersion, tc.userAgent)
23
+ return fmt.Sprintf("%s (%s != %s)\n", errAPIVersionMismatch, version.ApiVersion, tc.userAgent)
24
}
25
26
return tc.responseBody
@@ -30,7 +30,7 @@ func TestCheckVersionOption(t *testing.T) {
30
tcs := []testcasecheckversion{
31
{"/go-ipfs/0.1/", APIPath + "/test/", false, "", http.StatusBadRequest},
32
{"/go-ipfs/0.1/", APIPath + "/version", true, "check!", http.StatusOK},
33
- {repo.ApiVersion, APIPath + "/test", true, "check!", http.StatusOK},
33
+ {version.ApiVersion, APIPath + "/test", true, "check!", http.StatusOK},
34
{"Mozilla Firefox/no go-ipfs node", APIPath + "/test", true, "check!", http.StatusOK},
35
{"/go-ipfs/0.1/", "/webui", true, "check!", http.StatusOK},
36
}
docs/releases.md
+1
-1
@@ -30,7 +30,7 @@ will be allowed up to release day.
30
- [ ] publish gx version with `gx release`, as per [gx release guidelines](https://github.com/whyrusleeping/gx#publishing-and-releasing)
31
32
## Post-Release
33
-- [ ] bump version string in `repo/version.go` to `vX.Y.Z-dev`
33
+- [ ] Bump version string in `repo/version.go` to `vX.Y.Z-dev`
34
- [ ] Upload the final release to the github releases page: https://github.com/ipfs/go-ipfs/releases
35
- Communication
36
- [ ] Create the release issue
docs/windows.md
+1
-1
@@ -130,7 +130,7 @@ We need the `git` commit hash to be included in our build so that in the extreme
130
131
Finally, we'll build and test `ipfs` itself.
132
```
133
-go install -ldflags="-X "github.com/ipfs/go-ipfs/repo".CurrentCommit=%SHA%"
133
+go install -ldflags="-X "github.com/ipfs/go-ipfs".CurrentCommit=%SHA%"
134
%GOPATH%\bin\ipfs.exe version --all
135
```
136
You can check that the ipfs output versions match with `go version` and `git rev-parse --short HEAD`.
version.go
renamed
+2
-2
@@ -1,9 +1,9 @@
1
-package repo
1
+package ipfs
2
3
// CurrentCommit is the current git commit, this is set as a ldflag in the Makefile
4
var CurrentCommit string
5
6
// CurrentVersionNumber is the current application's version literal
7
-const CurrentVersionNumber = "0.4.17-dev"
7
+const CurrentVersionNumber = "0.4.18-dev"
8
9
const ApiVersion = "/go-ipfs/" + CurrentVersionNumber + "/"