Merge pull request #2546 from ywk253100/170616_test

Replace trimleft with trimprefix
This commit is contained in:
Wenkai Yin 2017-06-16 16:56:34 +08:00 committed by GitHub
commit 87d76bc465
2 changed files with 2 additions and 2 deletions

View File

@ -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)
} }

View File

@ -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)
} }