Skip to content

Commit e979867

Browse files
author
Raphaël Simon
authored
"golang.org/x/net/context" -> "context" (goadesign#1176)
1 parent 73531dc commit e979867

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+67
-65
lines changed

client/client.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"net/http/httputil"
1111
"time"
1212

13-
"golang.org/x/net/context"
13+
"context"
1414

1515
"github.com/goadesign/goa"
1616
)

client/client_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
package client_test
22

33
import (
4+
"context"
5+
46
"github.com/goadesign/goa/client"
5-
"golang.org/x/net/context"
67

78
. "github.com/onsi/ginkgo"
89
. "github.com/onsi/gomega"

context.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"net/url"
66
"strconv"
77

8-
"golang.org/x/net/context"
8+
"context"
99
)
1010

1111
// Keys used to store data in context.

context_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"net/http"
55
"net/url"
66

7-
"golang.org/x/net/context"
7+
"context"
88

99
"github.com/goadesign/goa"
1010
. "github.com/onsi/ginkgo"

cors/cors.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"regexp"
1010
"strings"
1111

12-
"golang.org/x/net/context"
12+
"context"
1313

1414
"github.com/goadesign/goa"
1515
)

doc.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ encoding algorithms.
1616
Request Context
1717
1818
The RequestData and ResponseData structs provides access to the request and response state. goa request
19-
handlers also accept a golang.org/x/net/Context interface as first parameter so that deadlines and
20-
cancelation signals may easily be implemented.
19+
handlers also accept a context.Context interface as first parameter so that deadlines and cancelation
20+
signals may easily be implemented.
2121
2222
The request state exposes the underlying http.Request object as well as the deserialized payload (request
2323
body) and parameters (both path and querystring parameters). Generated action specific contexts wrap

goagen/gen_app/generator.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func (g *Generator) generateContexts() error {
137137
codegen.SimpleImport("unicode/utf8"),
138138
codegen.SimpleImport("github.com/goadesign/goa"),
139139
codegen.NewImport("uuid", "github.com/satori/go.uuid"),
140-
codegen.SimpleImport("golang.org/x/net/context"),
140+
codegen.SimpleImport("context"),
141141
}
142142
g.API.IterateResources(func(r *design.ResourceDefinition) error {
143143
return r.IterateActions(func(a *design.ActionDefinition) error {
@@ -212,7 +212,7 @@ func (g *Generator) generateControllers() error {
212212
imports := []*codegen.ImportSpec{
213213
codegen.SimpleImport("net/http"),
214214
codegen.SimpleImport("fmt"),
215-
codegen.SimpleImport("golang.org/x/net/context"),
215+
codegen.SimpleImport("context"),
216216
codegen.SimpleImport("github.com/goadesign/goa"),
217217
codegen.SimpleImport("github.com/goadesign/goa/cors"),
218218
codegen.SimpleImport("regexp"),
@@ -323,7 +323,7 @@ func (g *Generator) generateSecurity() error {
323323
imports := []*codegen.ImportSpec{
324324
codegen.SimpleImport("net/http"),
325325
codegen.SimpleImport("errors"),
326-
codegen.SimpleImport("golang.org/x/net/context"),
326+
codegen.SimpleImport("context"),
327327
codegen.SimpleImport("github.com/goadesign/goa"),
328328
}
329329
secWr.WriteHeader(title, g.Target, imports)

goagen/gen_app/generator_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,8 @@ const contextsCodeTmpl = `// API "test api": Application Contexts
298298
package app
299299
300300
import (
301+
"context"
301302
"github.com/goadesign/goa"
302-
"golang.org/x/net/context"
303303
"net/http"
304304
)
305305
@@ -348,8 +348,8 @@ const controllersCodeTmpl = `// API "test api": Application Controllers
348348
package app
349349
350350
import (
351+
"context"
351352
"github.com/goadesign/goa"
352-
"golang.org/x/net/context"
353353
"net/http"
354354
)
355355

goagen/gen_app/test_generator.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func (g *Generator) generateResourceTest() error {
9494
codegen.SimpleImport(appPkg),
9595
codegen.SimpleImport("github.com/goadesign/goa"),
9696
codegen.SimpleImport("github.com/goadesign/goa/goatest"),
97-
codegen.SimpleImport("golang.org/x/net/context"),
97+
codegen.SimpleImport("context"),
9898
codegen.NewImport("uuid", "github.com/satori/go.uuid"),
9999
}
100100

goagen/gen_client/cli_generator.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ func (g *Generator) generateCommands(commandsFile string, clientPkg string, func
127127
codegen.SimpleImport("github.com/goadesign/goa"),
128128
codegen.SimpleImport("github.com/spf13/cobra"),
129129
codegen.SimpleImport(clientPkg),
130-
codegen.SimpleImport("golang.org/x/net/context"),
130+
codegen.SimpleImport("context"),
131131
codegen.SimpleImport("golang.org/x/net/websocket"),
132132
codegen.NewImport("uuid", "github.com/goadesign/goa/uuid"),
133133
}

goagen/gen_client/generator.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ func (g *Generator) generateResourceClient(pkgDir string, res *design.ResourceDe
327327
codegen.SimpleImport("strconv"),
328328
codegen.SimpleImport("strings"),
329329
codegen.SimpleImport("time"),
330-
codegen.SimpleImport("golang.org/x/net/context"),
330+
codegen.SimpleImport("context"),
331331
codegen.SimpleImport("golang.org/x/net/websocket"),
332332
codegen.NewImport("uuid", "github.com/goadesign/goa/uuid"),
333333
}

logging.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"fmt"
66
"log"
77

8-
"golang.org/x/net/context"
8+
"context"
99
)
1010

1111
// ErrMissingLogValue is the value used to log keys with missing values

logging/kit/adapter.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ Usage:
1515
package goakit
1616

1717
import (
18+
"context"
19+
1820
"github.com/go-kit/kit/log"
1921
"github.com/goadesign/goa"
20-
"golang.org/x/net/context"
2122
)
2223

2324
// adapter is the go-kit log goa logger adapter.

logging/log15/adapter.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ Usage:
1414
package goalog15
1515

1616
import (
17+
"context"
18+
1719
"github.com/goadesign/goa"
1820
"github.com/inconshreveable/log15"
19-
"golang.org/x/net/context"
2021
)
2122

2223
// adapter is the log15 goa adapter logger.

logging/log15/adapter_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
package goalog15_test
22

33
import (
4+
"context"
5+
46
"github.com/goadesign/goa"
57
"github.com/goadesign/goa/logging/log15"
68
"github.com/inconshreveable/log15"
79
. "github.com/onsi/ginkgo"
810
. "github.com/onsi/gomega"
9-
"golang.org/x/net/context"
1011
)
1112

1213
type TestHandler struct {

logging/logrus/adapter.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ package goalogrus
1616
import (
1717
"fmt"
1818

19-
"golang.org/x/net/context"
19+
"context"
2020

2121
"github.com/Sirupsen/logrus"
2222
"github.com/goadesign/goa"

logging/logrus/adapter_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package goalogrus_test
33
import (
44
"bytes"
55

6-
"golang.org/x/net/context"
6+
"context"
77

88
"github.com/Sirupsen/logrus"
99
"github.com/goadesign/goa"

logging_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ import (
44
"bytes"
55
"log"
66

7+
"context"
8+
79
"github.com/goadesign/goa"
810
. "github.com/onsi/ginkgo"
911
. "github.com/onsi/gomega"
10-
"golang.org/x/net/context"
1112
)
1213

1314
var _ = Describe("Info", func() {

middleware.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"fmt"
55
"net/http"
66

7-
"golang.org/x/net/context"
7+
"context"
88
)
99

1010
type (

middleware/error_handler.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ import (
44
"fmt"
55
"net/http"
66

7+
"context"
8+
79
"github.com/goadesign/goa"
8-
"golang.org/x/net/context"
910
)
1011

1112
// ErrorHandler turns a Go error into an HTTP response. It should be placed in the middleware chain

middleware/error_handler_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010

1111
pErrors "github.com/pkg/errors"
1212

13-
"golang.org/x/net/context"
13+
"context"
1414

1515
"github.com/goadesign/goa"
1616
"github.com/goadesign/goa/middleware"

middleware/gzip/middleware.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"strings"
88
"sync"
99

10-
"golang.org/x/net/context"
10+
"context"
1111

1212
"github.com/goadesign/goa"
1313
)

middleware/gzip/middleware_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"net/http"
88
"strings"
99

10-
"golang.org/x/net/context"
10+
"context"
1111

1212
"github.com/goadesign/goa"
1313
gzm "github.com/goadesign/goa/middleware/gzip"

middleware/log_request.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212

1313
"github.com/goadesign/goa"
1414

15-
"golang.org/x/net/context"
15+
"context"
1616
)
1717

1818
// LogRequest creates a request logger middleware.

middleware/log_request_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"net/url"
66
"strings"
77

8-
"golang.org/x/net/context"
8+
"context"
99

1010
"github.com/goadesign/goa"
1111
"github.com/goadesign/goa/middleware"

middleware/log_response.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55

66
"github.com/goadesign/goa"
77

8-
"golang.org/x/net/context"
8+
"context"
99
)
1010

1111
// loggingResponseWriter wraps an http.ResponseWriter and writes only raw

middleware/log_response_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"net/url"
66
"strings"
77

8-
"golang.org/x/net/context"
8+
"context"
99

1010
"github.com/goadesign/goa"
1111
"github.com/goadesign/goa/middleware"

middleware/middleware_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ import (
44
"net/http"
55
"net/url"
66

7+
"context"
8+
79
"github.com/goadesign/goa"
8-
"golang.org/x/net/context"
910
)
1011

1112
// Helper that sets up a "working" service

middleware/recover.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88

99
"github.com/goadesign/goa"
1010

11-
"golang.org/x/net/context"
11+
"context"
1212
)
1313

1414
// Recover is a middleware that recovers panics and maps them to errors.

middleware/recover_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"fmt"
55
"net/http"
66

7-
"golang.org/x/net/context"
7+
"context"
88

99
"github.com/goadesign/goa"
1010
"github.com/goadesign/goa/middleware"

middleware/request_id.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010

1111
"github.com/goadesign/goa"
1212

13-
"golang.org/x/net/context"
13+
"context"
1414
)
1515

1616
const (

middleware/request_id_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"net/http"
55
"net/url"
66

7-
"golang.org/x/net/context"
7+
"context"
88

99
"github.com/goadesign/goa"
1010
"github.com/goadesign/goa/middleware"

middleware/required_header.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66

77
"github.com/goadesign/goa"
88

9-
"golang.org/x/net/context"
9+
"context"
1010
)
1111

1212
// RequireHeader requires a request header to match a value pattern. If the

middleware/required_header_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"regexp"
66
"strings"
77

8-
"golang.org/x/net/context"
8+
"context"
99

1010
"github.com/goadesign/goa"
1111
"github.com/goadesign/goa/middleware"

middleware/security/basicauth/basicauth.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ package basicauth
33
import (
44
"net/http"
55

6+
"context"
7+
68
"github.com/goadesign/goa"
7-
"golang.org/x/net/context"
89
)
910

1011
// ErrBasicAuthFailed means it wasn't able to authenticate you with your login/password.

middleware/security/jwt/context.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package jwt
22

33
import (
4-
"golang.org/x/net/context"
4+
"context"
55

66
jwt "github.com/dgrijalva/jwt-go"
77
)

middleware/security/jwt/jwt.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ import (
88
"sort"
99
"strings"
1010

11+
"context"
12+
1113
jwt "github.com/dgrijalva/jwt-go"
1214
"github.com/goadesign/goa"
13-
"golang.org/x/net/context"
1415
)
1516

1617
// New returns a middleware to be used with the JWTSecurity DSL definitions of goa. It supports the

0 commit comments

Comments
 (0)