mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-27 02:58:05 +01:00
Merge pull request #2546 from ywk253100/170616_test
Replace trimleft with trimprefix
This commit is contained in:
commit
87d76bc465
@ -190,7 +190,7 @@ func TestParseLink(t *testing.T) {
|
|||||||
func TestTestTCPConn(t *testing.T) {
|
func TestTestTCPConn(t *testing.T) {
|
||||||
server := httptest.NewServer(nil)
|
server := httptest.NewServer(nil)
|
||||||
defer server.Close()
|
defer server.Close()
|
||||||
addr := strings.TrimLeft(server.URL, "http://")
|
addr := strings.TrimPrefix(server.URL, "http://")
|
||||||
if err := TestTCPConn(addr, 60, 2); err != nil {
|
if err := TestTCPConn(addr, 60, 2); err != nil {
|
||||||
t.Fatalf("failed to test tcp connection of %s: %v", addr, err)
|
t.Fatalf("failed to test tcp connection of %s: %v", addr, err)
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ func parse(b []byte) ([]*project, error) {
|
|||||||
|
|
||||||
projects := []*project{}
|
projects := []*project{}
|
||||||
for link, project := range documents.Projects {
|
for link, project := range documents.Projects {
|
||||||
project.ID = strings.TrimLeft(link, "/projects/")
|
project.ID = strings.TrimPrefix(link, "/projects/")
|
||||||
projects = append(projects, project)
|
projects = append(projects, project)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user