-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into just-cid
* origin/main: chore: bump go.mod to Go 1.22 and run go fix (#51) chore: port version.go from rainbow chore: bump libp2p and kad-dht fix: make overflown text scroll chore: go-libp2p-kad-dht v0.26.1 chore: first release
- Loading branch information
Showing
7 changed files
with
71 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package main | ||
|
||
import ( | ||
_ "embed" | ||
"encoding/json" | ||
"fmt" | ||
"runtime/debug" | ||
"time" | ||
) | ||
|
||
//go:embed version.json | ||
var versionJSON []byte | ||
|
||
var name = "ipfs-check" | ||
var version = buildVersion() | ||
var userAgent = name + "/" + version | ||
|
||
func buildVersion() string { | ||
// Read version from embedded JSON file. | ||
var verMap map[string]string | ||
json.Unmarshal(versionJSON, &verMap) | ||
release := verMap["version"] | ||
|
||
var revision string | ||
var day string | ||
var dirty bool | ||
|
||
info, ok := debug.ReadBuildInfo() | ||
if !ok { | ||
return release + " dev-build" | ||
} | ||
for _, kv := range info.Settings { | ||
switch kv.Key { | ||
case "vcs.revision": | ||
revision = kv.Value[:7] | ||
case "vcs.time": | ||
t, _ := time.Parse(time.RFC3339, kv.Value) | ||
day = t.UTC().Format("2006-01-02") | ||
case "vcs.modified": | ||
dirty = kv.Value == "true" | ||
} | ||
} | ||
if dirty { | ||
revision += "-dirty" | ||
} | ||
if revision != "" { | ||
return fmt.Sprintf("%s %s-%s", release, day, revision) | ||
} | ||
return release + " dev-build" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"version": "" | ||
"version": "0.1.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters