Skip to content

Commit

Permalink
Replace url.JoinPath with path.Join in order to compatible with <go1.19
Browse files Browse the repository at this point in the history
  • Loading branch information
dongxuny committed Dec 14, 2022
1 parent 7c12eb4 commit 1ed6c81
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 403 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: 1.17
go-version: 1.18
- name: Setup golangci-lint
uses: golangci/[email protected]
- name: Run linter
Expand Down
10 changes: 5 additions & 5 deletions entry/common_service_entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/rookie-ninja/rk-entry/v2"
"github.com/rookie-ninja/rk-entry/v2/os"
"net/http"
"net/url"
"path"
"runtime"
)

Expand Down Expand Up @@ -86,10 +86,10 @@ func RegisterCommonServiceEntry(boot *BootCommonService, opts ...CommonServiceEn
}

// append prefix
entry.ReadyPath, _ = url.JoinPath("/", entry.pathPrefix, entry.ReadyPath)
entry.AlivePath, _ = url.JoinPath("/", entry.pathPrefix, entry.AlivePath)
entry.GcPath, _ = url.JoinPath("/", entry.pathPrefix, entry.GcPath)
entry.InfoPath, _ = url.JoinPath("/", entry.pathPrefix, entry.InfoPath)
entry.ReadyPath = path.Join("/", entry.pathPrefix, entry.ReadyPath)
entry.AlivePath = path.Join("/", entry.pathPrefix, entry.AlivePath)
entry.GcPath = path.Join("/", entry.pathPrefix, entry.GcPath)
entry.InfoPath = path.Join("/", entry.pathPrefix, entry.InfoPath)

// change swagger config file
oldSwAssets := readFile("assets/sw/config/swagger.json", &rkembed.AssetsFS, true)
Expand Down
3 changes: 1 addition & 2 deletions entry/docs_entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/rookie-ninja/rk-entry/v2"
"io/ioutil"
"net/http"
"net/url"
"os"
"path"
"path/filepath"
Expand Down Expand Up @@ -246,8 +245,8 @@ func (entry *DocsEntry) initDocsConfig() {
specFiles[key] = string(swAssetsFile)
e := &spec{
Name: key,
Url: path.Join(entry.Path, key),
}
e.Url, _ = url.JoinPath(entry.Path, key)
config.Specs = append(config.Specs, e)
}

Expand Down
4 changes: 2 additions & 2 deletions entry/pprof_entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package rkentry
import (
"context"
"encoding/json"
"net/url"
"path"
"strings"
)

Expand Down Expand Up @@ -86,7 +86,7 @@ func RegisterPProfEntry(boot *BootPProf, opts ...PProfEntryOption) *PProfEntry {
entry.Path = "/pprof"
}

entry.Path, _ = url.JoinPath("/", entry.Path)
entry.Path = path.Join("/", entry.Path)
if !strings.HasSuffix(entry.Path, "/") {
entry.Path = entry.Path + "/"
}
Expand Down
3 changes: 1 addition & 2 deletions entry/static_file_handler_entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"io/fs"
"math"
"net/http"
"net/url"
"os"
"path"
"path/filepath"
Expand Down Expand Up @@ -206,7 +205,7 @@ func (entry *StaticFileHandlerEntry) GetFileHandler() http.HandlerFunc {
if len(p) < 1 {
p = "/"
}
p, _ = url.JoinPath("/", p)
p = path.Join("/", p)

var file http.File
var err error
Expand Down
3 changes: 1 addition & 2 deletions entry/sw_entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
rkmid "github.com/rookie-ninja/rk-entry/v2/middleware"
"io/ioutil"
"net/http"
"net/url"
"os"
"path"
"path/filepath"
Expand Down Expand Up @@ -249,8 +248,8 @@ func (entry *SWEntry) initSwaggerConfig() {
swaggerJsonFiles[key] = string(swAssetsFile)
e := &swUrl{
Name: key,
Url: path.Join(entry.Path, key),
}
e.Url, _ = url.JoinPath(entry.Path, key)
swaggerUrlConfig.Urls = append(swaggerUrlConfig.Urls, e)
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/rookie-ninja/rk-entry/v2

go 1.17
go 1.18

require (
github.com/golang-jwt/jwt/v4 v4.4.2
Expand Down
388 changes: 0 additions & 388 deletions go.sum

Large diffs are not rendered by default.

0 comments on commit 1ed6c81

Please sign in to comment.