Skip to content

Commit

Permalink
all: use uuidv1 to reserve time info
Browse files Browse the repository at this point in the history
  • Loading branch information
changkun committed Apr 19, 2021
1 parent 228d8eb commit 43510a4
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 22 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.14

require (
github.com/gin-gonic/gin v1.6.2
github.com/google/uuid v1.1.1
github.com/google/uuid v1.2.0
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e
gopkg.in/yaml.v2 v2.2.8
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GO
github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I=
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs=
github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y=
Expand Down
3 changes: 2 additions & 1 deletion src/route/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ type BuildSSAOutput struct {
func BuildSSA(c *gin.Context) {
// 1. create a folder in config.Get().Static/buildbox
out := BuildSSAOutput{
BuildID: uuid.New().String(),
// use UUIDv1 such that the id contains time information
BuildID: uuid.Must(uuid.NewUUID()).String(),
}
path := filepath.Join(config.Get().Static, "/buildbox", "/"+out.BuildID)

Expand Down
2 changes: 1 addition & 1 deletion src/route/static.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type localFileSystem struct {
indexes bool
}

func loacalFile(root string, indexes bool) *localFileSystem {
func loacalFile(root string, indexes bool) serveFS {
return &localFileSystem{
FileSystem: gin.Dir(root, indexes),
root: root,
Expand Down
2 changes: 1 addition & 1 deletion vendor/github.com/google/uuid/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions vendor/github.com/google/uuid/hash.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions vendor/github.com/google/uuid/marshal.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/google/uuid/sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions vendor/github.com/google/uuid/uuid.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions vendor/github.com/google/uuid/version1.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 14 additions & 1 deletion vendor/github.com/google/uuid/version4.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ github.com/go-playground/universal-translator
github.com/go-playground/validator/v10
# github.com/golang/protobuf v1.3.3
github.com/golang/protobuf/proto
# github.com/google/uuid v1.1.1
# github.com/google/uuid v1.2.0
## explicit
github.com/google/uuid
# github.com/json-iterator/go v1.1.9
Expand Down

0 comments on commit 43510a4

Please sign in to comment.