Skip to content

Commit 601692b

Browse files
committed
examples use v3
1 parent a0fdb2a commit 601692b

Some content is hidden

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

64 files changed

+332
-153
lines changed

CHANGES.md

+5-5

Makefile

+1-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,4 @@ all: test
22

33
test:
44
go vet .
5-
go test -cover -v .
6-
7-
ex:
8-
cd examples && ls *.go | xargs go build -o /tmp/ignore
5+
go test -cover -v .

README.md

+7-7

examples/README.md

+1

examples/basicauth/go.mod

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module github.com/emicklei/go-restful/examples/basicauth
2+
3+
go 1.14
4+
5+
require github.com/emicklei/go-restful/v3 v3.3.3 // indirect

examples/basicauth/go.sum

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
github.com/emicklei/go-restful v1.1.3 h1:KOKLkEASmIa2roa2xEV6WkADqyWrok5dt3TOMMHF1fE=
2+
github.com/emicklei/go-restful v2.14.3+incompatible h1:i59XyRHAxKCVBw3vHzQlpP/+pi89wH1v1HL+RKyVgxk=
3+
github.com/emicklei/go-restful/v3 v3.3.3 h1:2WxjFb4b+Eik8vJ1saz3jbhKnt4xaFVn3N9uU3WXfLE=
4+
github.com/emicklei/go-restful/v3 v3.3.3/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=

examples/restful-basic-authentication.go renamed to examples/basicauth/restful-basic-authentication.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package main
22

33
import (
4-
"github.com/emicklei/go-restful"
54
"io"
65
"log"
76
"net/http"
7+
8+
restful "github.com/emicklei/go-restful/v3"
89
)
910

1011
// This example shows how to create a (Route) Filter that performs Basic Authentication on the Http request.

examples/cors/go.mod

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module github.com/emicklei/go-restful/examples/cors
2+
3+
go 1.14
4+
5+
require github.com/emicklei/go-restful/v3 v3.3.3 // indirect

examples/cors/go.sum

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
github.com/emicklei/go-restful v1.1.3 h1:KOKLkEASmIa2roa2xEV6WkADqyWrok5dt3TOMMHF1fE=
2+
github.com/emicklei/go-restful v2.14.3+incompatible h1:i59XyRHAxKCVBw3vHzQlpP/+pi89wH1v1HL+RKyVgxk=
3+
github.com/emicklei/go-restful/v3 v3.3.3 h1:2WxjFb4b+Eik8vJ1saz3jbhKnt4xaFVn3N9uU3WXfLE=
4+
github.com/emicklei/go-restful/v3 v3.3.3/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=

examples/restful-CORS-filter.go renamed to examples/cors/restful-CORS-filter.go

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

8-
"github.com/emicklei/go-restful"
8+
restful "github.com/emicklei/go-restful/v3"
99
)
1010

1111
// Cross-origin resource sharing (CORS) is a mechanism that allows JavaScript on a web page

examples/cpuprof/go.mod

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module github.com/emicklei/go-restful/examples/cpuprof
2+
3+
go 1.14
4+
5+
require github.com/emicklei/go-restful/v3 v3.3.3 // indirect

examples/cpuprof/go.sum

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
github.com/emicklei/go-restful v1.1.3 h1:KOKLkEASmIa2roa2xEV6WkADqyWrok5dt3TOMMHF1fE=
2+
github.com/emicklei/go-restful v2.14.3+incompatible h1:i59XyRHAxKCVBw3vHzQlpP/+pi89wH1v1HL+RKyVgxk=
3+
github.com/emicklei/go-restful/v3 v3.3.3 h1:2WxjFb4b+Eik8vJ1saz3jbhKnt4xaFVn3N9uU3WXfLE=
4+
github.com/emicklei/go-restful/v3 v3.3.3/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=

examples/restful-cpuprofiler-service.go renamed to examples/cpuprof/restful-cpuprofiler-service.go

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

33
import (
4-
"github.com/emicklei/go-restful"
54
"io"
65
"log"
76
"os"
87
"runtime/pprof"
8+
9+
restful "github.com/emicklei/go-restful/v3"
910
)
1011

1112
// ProfilingService is a WebService that can start/stop a CPU profile and write results to a file

examples/encoding/go.mod

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module github.com/emicklei/go-restful/examples/encoding
2+
3+
go 1.14
4+
5+
require github.com/emicklei/go-restful/v3 v3.3.3 // indirect

examples/encoding/go.sum

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
github.com/emicklei/go-restful v1.1.3 h1:KOKLkEASmIa2roa2xEV6WkADqyWrok5dt3TOMMHF1fE=
2+
github.com/emicklei/go-restful v2.14.3+incompatible h1:i59XyRHAxKCVBw3vHzQlpP/+pi89wH1v1HL+RKyVgxk=
3+
github.com/emicklei/go-restful/v3 v3.3.3 h1:2WxjFb4b+Eik8vJ1saz3jbhKnt4xaFVn3N9uU3WXfLE=
4+
github.com/emicklei/go-restful/v3 v3.3.3/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=

examples/restful-encoding-filter.go renamed to examples/encoding/restful-encoding-filter.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
package main
22

33
import (
4-
"github.com/emicklei/go-restful"
54
"log"
65
"net/http"
6+
7+
restful "github.com/emicklei/go-restful/v3"
78
)
89

910
type User struct {

examples/filters/go.mod

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module github.com/emicklei/go-restful/examples/filters
2+
3+
go 1.14
4+
5+
require github.com/emicklei/go-restful/v3 v3.3.3 // indirect

examples/filters/go.sum

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
github.com/emicklei/go-restful v1.1.3 h1:KOKLkEASmIa2roa2xEV6WkADqyWrok5dt3TOMMHF1fE=
2+
github.com/emicklei/go-restful v2.14.3+incompatible h1:i59XyRHAxKCVBw3vHzQlpP/+pi89wH1v1HL+RKyVgxk=
3+
github.com/emicklei/go-restful/v3 v3.3.3 h1:2WxjFb4b+Eik8vJ1saz3jbhKnt4xaFVn3N9uU3WXfLE=
4+
github.com/emicklei/go-restful/v3 v3.3.3/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=

examples/restful-filters.go renamed to examples/filters/restful-filters.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package main
22

33
import (
4-
"github.com/emicklei/go-restful"
54
"log"
65
"net/http"
76
"time"
7+
8+
restful "github.com/emicklei/go-restful/v3"
89
)
910

1011
type User struct {

examples/form/go.mod

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module github.com/emicklei/go-restful/examples/form
2+
3+
go 1.14
4+
5+
require (
6+
github.com/emicklei/go-restful/v3 v3.3.3 // indirect
7+
github.com/gorilla/schema v1.2.0 // indirect
8+
)

examples/form/go.sum

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
github.com/emicklei/go-restful v1.1.3 h1:KOKLkEASmIa2roa2xEV6WkADqyWrok5dt3TOMMHF1fE=
2+
github.com/emicklei/go-restful v2.14.3+incompatible h1:i59XyRHAxKCVBw3vHzQlpP/+pi89wH1v1HL+RKyVgxk=
3+
github.com/emicklei/go-restful/v3 v3.3.3 h1:2WxjFb4b+Eik8vJ1saz3jbhKnt4xaFVn3N9uU3WXfLE=
4+
github.com/emicklei/go-restful/v3 v3.3.3/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
5+
github.com/gorilla/schema v1.2.0 h1:YufUaxZYCKGFuAq3c96BOhjgd5nmXiOY9NGzF247Tsc=
6+
github.com/gorilla/schema v1.2.0/go.mod h1:kgLaKoK1FELgZqMAVxx/5cbj0kT+57qxUrAlIO2eleU=

examples/restful-form-handling.go renamed to examples/form/restful-form-handling.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ package main
22

33
import (
44
"fmt"
5-
"github.com/emicklei/go-restful"
6-
"github.com/gorilla/schema"
75
"io"
86
"log"
97
"net/http"
8+
9+
restful "github.com/emicklei/go-restful/v3"
10+
"github.com/gorilla/schema"
1011
)
1112

1213
// This example shows how to handle a POST of a HTML form that uses the standard x-www-form-urlencoded content-type.

examples/fulllog/go.mod

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module github.com/emicklei/go-restful/examples/fulllog
2+
3+
go 1.14
4+
5+
require github.com/emicklei/go-restful/v3 v3.3.3 // indirect

examples/fulllog/go.sum

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
github.com/emicklei/go-restful v1.1.3 h1:KOKLkEASmIa2roa2xEV6WkADqyWrok5dt3TOMMHF1fE=
2+
github.com/emicklei/go-restful v2.14.3+incompatible h1:i59XyRHAxKCVBw3vHzQlpP/+pi89wH1v1HL+RKyVgxk=
3+
github.com/emicklei/go-restful/v3 v3.3.3 h1:2WxjFb4b+Eik8vJ1saz3jbhKnt4xaFVn3N9uU3WXfLE=
4+
github.com/emicklei/go-restful/v3 v3.3.3/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=

examples/restful-full-logging-filter.go renamed to examples/fulllog/restful-full-logging-filter.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"log"
77
"net/http"
88

9-
"github.com/emicklei/go-restful"
9+
restful "github.com/emicklei/go-restful/v3"
1010
)
1111

1212
type User struct {

examples/google-custom-method/go.mod

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module github.com/emicklei/go-restful/examples/google-custom-method
2+
3+
go 1.14
4+
5+
require github.com/emicklei/go-restful/v3 v3.3.3 // indirect

examples/google-custom-method/go.sum

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
github.com/emicklei/go-restful v1.1.3 h1:KOKLkEASmIa2roa2xEV6WkADqyWrok5dt3TOMMHF1fE=
2+
github.com/emicklei/go-restful v2.14.3+incompatible h1:i59XyRHAxKCVBw3vHzQlpP/+pi89wH1v1HL+RKyVgxk=
3+
github.com/emicklei/go-restful/v3 v3.3.3 h1:2WxjFb4b+Eik8vJ1saz3jbhKnt4xaFVn3N9uU3WXfLE=
4+
github.com/emicklei/go-restful/v3 v3.3.3/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=

examples/restful-google-custom-method.go renamed to examples/google-custom-method/restful-google-custom-method.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package main
22

33
import (
4-
. "github.com/emicklei/go-restful"
54
"io"
65
"log"
76
"net/http"
7+
8+
. "github.com/emicklei/go-restful/v3"
89
)
910

1011
// This example shows how to create a Route with google custom method

examples/hello/go.mod

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module github.com/emicklei/go-restful/examples/hello
2+
3+
go 1.14
4+
5+
require github.com/emicklei/go-restful/v3 v3.3.3 // indirect

examples/hello/go.sum

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
github.com/emicklei/go-restful v1.1.3 h1:KOKLkEASmIa2roa2xEV6WkADqyWrok5dt3TOMMHF1fE=
2+
github.com/emicklei/go-restful v2.14.3+incompatible h1:i59XyRHAxKCVBw3vHzQlpP/+pi89wH1v1HL+RKyVgxk=
3+
github.com/emicklei/go-restful/v3 v3.3.3 h1:2WxjFb4b+Eik8vJ1saz3jbhKnt4xaFVn3N9uU3WXfLE=
4+
github.com/emicklei/go-restful/v3 v3.3.3/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=

examples/restful-hello-world.go renamed to examples/hello/restful-hello-world.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package main
22

33
import (
4-
"github.com/emicklei/go-restful"
54
"io"
65
"log"
76
"net/http"
7+
8+
restful "github.com/emicklei/go-restful/v3"
89
)
910

1011
// This example shows the minimal code needed to get a restful.WebService working.

examples/jwtauth/go.mod

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module github.com/emicklei/go-restful/examples/jwtauth
2+
3+
go 1.14
4+
5+
require (
6+
github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect
7+
github.com/emicklei/go-restful/v3 v3.3.3 // indirect
8+
)

examples/jwtauth/go.sum

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
github.com/dgrijalva/jwt-go v1.0.2 h1:KPldsxuKGsS2FPWsNeg9ZO18aCrGKujPoWXn2yo+KQM=
2+
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
3+
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
4+
github.com/emicklei/go-restful v1.1.3 h1:KOKLkEASmIa2roa2xEV6WkADqyWrok5dt3TOMMHF1fE=
5+
github.com/emicklei/go-restful v2.14.3+incompatible h1:i59XyRHAxKCVBw3vHzQlpP/+pi89wH1v1HL+RKyVgxk=
6+
github.com/emicklei/go-restful/v3 v3.3.3 h1:2WxjFb4b+Eik8vJ1saz3jbhKnt4xaFVn3N9uU3WXfLE=
7+
github.com/emicklei/go-restful/v3 v3.3.3/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=

examples/restful-jwt-authentication.go renamed to examples/jwtauth/restful-jwt-authentication.go

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

33
import (
4-
"github.com/dgrijalva/jwt-go"
5-
"github.com/emicklei/go-restful"
64
"io"
75
"log"
86
"net/http"
97
"strings"
8+
9+
"github.com/dgrijalva/jwt-go"
10+
restful "github.com/emicklei/go-restful/v3"
1011
)
1112

1213
// This example shows how to create a (Route) Filter that performs a JWT HS512 authentication.

examples/msgpack/msgpack_entity.go

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

33
import (
4-
restful "github.com/emicklei/go-restful"
4+
restful "github.com/emicklei/go-restful/v3"
55
"gopkg.in/vmihailenco/msgpack.v2"
66
)
77

examples/multi-container/go.mod

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module github.com/emicklei/go-restful/examples/multi-container
2+
3+
go 1.14
4+
5+
require github.com/emicklei/go-restful/v3 v3.3.3 // indirect

examples/multi-container/go.sum

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
github.com/emicklei/go-restful v1.1.3 h1:KOKLkEASmIa2roa2xEV6WkADqyWrok5dt3TOMMHF1fE=
2+
github.com/emicklei/go-restful v2.14.3+incompatible h1:i59XyRHAxKCVBw3vHzQlpP/+pi89wH1v1HL+RKyVgxk=
3+
github.com/emicklei/go-restful/v3 v3.3.3 h1:2WxjFb4b+Eik8vJ1saz3jbhKnt4xaFVn3N9uU3WXfLE=
4+
github.com/emicklei/go-restful/v3 v3.3.3/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=

examples/restful-multi-containers.go renamed to examples/multi-container/restful-multi-containers.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package main
22

33
import (
4-
"github.com/emicklei/go-restful"
54
"io"
65
"log"
76
"net/http"
7+
8+
restful "github.com/emicklei/go-restful/v3"
89
)
910

1011
// This example shows how to have a program with 2 WebServices containers

examples/ncsa/go.mod

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module github.com/emicklei/go-restful/examples/ncsa
2+
3+
go 1.14
4+
5+
require github.com/emicklei/go-restful/v3 v3.3.3 // indirect

examples/ncsa/go.sum

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
github.com/emicklei/go-restful v1.1.3 h1:KOKLkEASmIa2roa2xEV6WkADqyWrok5dt3TOMMHF1fE=
2+
github.com/emicklei/go-restful v2.14.3+incompatible h1:i59XyRHAxKCVBw3vHzQlpP/+pi89wH1v1HL+RKyVgxk=
3+
github.com/emicklei/go-restful/v3 v3.3.3 h1:2WxjFb4b+Eik8vJ1saz3jbhKnt4xaFVn3N9uU3WXfLE=
4+
github.com/emicklei/go-restful/v3 v3.3.3/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=

examples/restful-NCSA-logging.go renamed to examples/ncsa/restful-NCSA-logging.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
package main
22

33
import (
4-
"github.com/emicklei/go-restful"
54
"io"
65
"log"
76
"net/http"
87
"os"
98
"strings"
109
"time"
10+
11+
restful "github.com/emicklei/go-restful/v3"
1112
)
1213

1314
// This example shows how to create a filter that produces log lines

examples/nocache/go.mod

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module github.com/emicklei/go-restful/examples/nocache
2+
3+
go 1.14
4+
5+
require github.com/emicklei/go-restful/v3 v3.3.3 // indirect

examples/nocache/go.sum

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
github.com/emicklei/go-restful v1.1.3 h1:KOKLkEASmIa2roa2xEV6WkADqyWrok5dt3TOMMHF1fE=
2+
github.com/emicklei/go-restful v2.14.3+incompatible h1:i59XyRHAxKCVBw3vHzQlpP/+pi89wH1v1HL+RKyVgxk=
3+
github.com/emicklei/go-restful/v3 v3.3.3 h1:2WxjFb4b+Eik8vJ1saz3jbhKnt4xaFVn3N9uU3WXfLE=
4+
github.com/emicklei/go-restful/v3 v3.3.3/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=

0 commit comments

Comments
 (0)