Skip to content

Commit

Permalink
use correct go mod semver (#395)
Browse files Browse the repository at this point in the history
Signed-off-by: Scott Nichols <snichols@vmware.com>
  • Loading branch information
n3wscott authored Mar 18, 2020
1 parent f248e16 commit 0a5202b
Show file tree
Hide file tree
Showing 453 changed files with 1,119 additions and 783 deletions.
10 changes: 5 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ jobs:

- restore_cache:
keys:
- gomod-cache-{{ checksum "go.sum" }}
- gomod-cache-{{ checksum "v2/go.sum" }}
- run:
name: "Check modules via go tidy"
command: go mod tidy && git diff --exit-code go.{mod,sum}
command: pushd v2; go mod tidy && git diff --exit-code go.{mod,sum}; popd
- run:
name: "Enforce Go Formatted Code"
command: "! GO111MODULE=off go fmt ./... 2>&1 | read" # Avoid any dependency resolution
command: "! GO111MODULE=off go fmt ./v2/... 2>&1 | read" # Avoid any dependency resolution
- run:
name: "Run go vet"
command: go vet ./...
command: pushd v2; go vet ./...; popd
- run:
name: Run unit tests
command: |
Expand All @@ -55,7 +55,7 @@ jobs:
TEST_AMQP_URL=amqp://localhost/test ./hack/integration-test.sh | tee ${TEST_RESULTS}/go-integration-test.out
- save_cache:
key: gomod-cache-{{ checksum "go.sum" }}
key: gomod-cache-{{ checksum "v2/go.sum" }}
paths:
- "/go/pkg/mod"

Expand Down
5 changes: 5 additions & 0 deletions hack/integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@ set -o errexit
set -o nounset
set -o pipefail

# v2 only
pushd ./v2

# Run integration tests not in parallel
go test -v -parallel 1 ./test/... -coverprofile ${TEST_RESULTS:-.}/integration_test_cover.out -timeout 60s

# Remove test only deps.
go mod tidy

popd
12 changes: 10 additions & 2 deletions hack/unit-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@ set -o errexit
set -o nounset
set -o pipefail

# Test everything in pkg and cmd, except amqp
go test -v ./pkg/... ./cmd/... -coverprofile ${TEST_RESULTS:-.}/unit_test_cover.out -timeout 15s
# v1
pushd ./v1
go test -v ./... -coverprofile ${TEST_RESULTS:-.}/unit_test_cover.out -timeout 15s
# Remove test only deps.
go mod tidy
popd

# v2
pushd ./v2
go test -v ./... -coverprofile ${TEST_RESULTS:-.}/unit_test_cover.out -timeout 15s
# Remove test only deps.
go mod tidy
popd
2 changes: 1 addition & 1 deletion legacy/README.md → v1/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# NOTE: The Legacy directory will be removed for v2.0.0.
# NOTE: The v1 directory will be removed for v2.0.0.

We will make a final migration release that will match the v2.0.0 release with
the addition of this legacy directory for migration support.
Expand Down
14 changes: 7 additions & 7 deletions legacy/alias.go → v1/alias.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package cloudevents
package v1

// Package cloudevents alias' common functions and types to improve discoverability and reduce
// the number of imports for simple HTTP clients.

import (
"github.com/cloudevents/sdk-go/legacy/pkg/cloudevents"
"github.com/cloudevents/sdk-go/legacy/pkg/cloudevents/client"
"github.com/cloudevents/sdk-go/legacy/pkg/cloudevents/context"
"github.com/cloudevents/sdk-go/legacy/pkg/cloudevents/observability"
"github.com/cloudevents/sdk-go/legacy/pkg/cloudevents/transport/http"
"github.com/cloudevents/sdk-go/legacy/pkg/cloudevents/types"
"github.com/cloudevents/sdk-go/v1/cloudevents"
"github.com/cloudevents/sdk-go/v1/cloudevents/client"
"github.com/cloudevents/sdk-go/v1/cloudevents/context"
"github.com/cloudevents/sdk-go/v1/cloudevents/observability"
"github.com/cloudevents/sdk-go/v1/cloudevents/transport/http"
"github.com/cloudevents/sdk-go/v1/cloudevents/types"
)

// Client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package buffering
import (
"sync/atomic"

"github.com/cloudevents/sdk-go/legacy/pkg/binding"
"github.com/cloudevents/sdk-go/v1/binding"
)

type acksMessage struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (

"github.com/stretchr/testify/assert"

cloudevents "github.com/cloudevents/sdk-go/legacy"
"github.com/cloudevents/sdk-go/legacy/pkg/binding"
"github.com/cloudevents/sdk-go/legacy/pkg/cloudevents/types"
cloudevents "github.com/cloudevents/sdk-go/v1"
"github.com/cloudevents/sdk-go/v1/binding"
"github.com/cloudevents/sdk-go/v1/cloudevents/types"
)

func TestWithAcksBeforeFinish(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (

"github.com/valyala/bytebufferpool"

"github.com/cloudevents/sdk-go/legacy/pkg/binding"
"github.com/cloudevents/sdk-go/legacy/pkg/binding/spec"
"github.com/cloudevents/sdk-go/v1/binding"
"github.com/cloudevents/sdk-go/v1/binding/spec"
)

var binaryMessagePool bytebufferpool.Pool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package buffering
import (
"context"

"github.com/cloudevents/sdk-go/legacy/pkg/binding"
"github.com/cloudevents/sdk-go/v1/binding"
)

// BufferMessage does the same than CopyMessage and it also bounds the original Message
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"testing"

"github.com/cloudevents/sdk-go/legacy/pkg/binding/test"
"github.com/cloudevents/sdk-go/v1/binding/test"
)

var err error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/cloudevents/sdk-go/legacy/pkg/binding"
"github.com/cloudevents/sdk-go/legacy/pkg/binding/test"
"github.com/cloudevents/sdk-go/legacy/pkg/cloudevents"
"github.com/cloudevents/sdk-go/v1/binding"
"github.com/cloudevents/sdk-go/v1/binding/test"
"github.com/cloudevents/sdk-go/v1/cloudevents"
)

type copyMessageTestCase struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (

"github.com/valyala/bytebufferpool"

"github.com/cloudevents/sdk-go/legacy/pkg/binding"
"github.com/cloudevents/sdk-go/legacy/pkg/binding/format"
"github.com/cloudevents/sdk-go/v1/binding"
"github.com/cloudevents/sdk-go/v1/binding/format"
)

var structMessagePool bytebufferpool.Pool
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"bytes"
"context"

cloudevents "github.com/cloudevents/sdk-go/legacy"
"github.com/cloudevents/sdk-go/legacy/pkg/binding/format"
"github.com/cloudevents/sdk-go/legacy/pkg/binding/spec"
ce "github.com/cloudevents/sdk-go/legacy/pkg/cloudevents"
cloudevents "github.com/cloudevents/sdk-go/v1"
"github.com/cloudevents/sdk-go/v1/binding/format"
"github.com/cloudevents/sdk-go/v1/binding/spec"
ce "github.com/cloudevents/sdk-go/v1/cloudevents"
)

// EventMessage type-converts a cloudevents.Event object to implement Message.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"io"
"io/ioutil"

"github.com/cloudevents/sdk-go/legacy/pkg/binding"
"github.com/cloudevents/sdk-go/legacy/pkg/binding/format"
"github.com/cloudevents/sdk-go/legacy/pkg/cloudevents/transport"
"github.com/cloudevents/sdk-go/v1/binding"
"github.com/cloudevents/sdk-go/v1/binding/format"
"github.com/cloudevents/sdk-go/v1/cloudevents/transport"
)

// ExMessage is a json.RawMessage, a byte slice containing a JSON encoded event.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"io"
"strconv"

"github.com/cloudevents/sdk-go/legacy/pkg/cloudevents"
"github.com/cloudevents/sdk-go/legacy/pkg/cloudevents/client"
"github.com/cloudevents/sdk-go/v1/cloudevents"
"github.com/cloudevents/sdk-go/v1/cloudevents/client"
)

const count = 3 // Example ends after this many events.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (

"github.com/stretchr/testify/assert"

cloudevents "github.com/cloudevents/sdk-go/legacy"
"github.com/cloudevents/sdk-go/legacy/pkg/binding"
"github.com/cloudevents/sdk-go/legacy/pkg/cloudevents/types"
cloudevents "github.com/cloudevents/sdk-go/v1"
"github.com/cloudevents/sdk-go/v1/binding"
"github.com/cloudevents/sdk-go/v1/cloudevents/types"
)

func TestWithFinish(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"fmt"
"strings"

ce "github.com/cloudevents/sdk-go/legacy/pkg/cloudevents"
ce "github.com/cloudevents/sdk-go/v1/cloudevents"
)

// Format marshals and unmarshals structured events to bytes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (

"github.com/stretchr/testify/assert"

"github.com/cloudevents/sdk-go/legacy/pkg/binding/format"
ce "github.com/cloudevents/sdk-go/legacy/pkg/cloudevents"
"github.com/cloudevents/sdk-go/legacy/pkg/cloudevents/types"
"github.com/cloudevents/sdk-go/v1/binding/format"
ce "github.com/cloudevents/sdk-go/v1/cloudevents"
"github.com/cloudevents/sdk-go/v1/cloudevents/types"
)

func TestJSON(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions legacy/pkg/binding/interfaces.go → v1/binding/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"errors"
"io"

"github.com/cloudevents/sdk-go/legacy/pkg/binding/format"
"github.com/cloudevents/sdk-go/legacy/pkg/binding/spec"
"github.com/cloudevents/sdk-go/v1/binding/format"
"github.com/cloudevents/sdk-go/v1/binding/spec"
)

// Encoding enum specifies the type of encodings supported by binding interfaces
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"time"

ce "github.com/cloudevents/sdk-go/legacy/pkg/cloudevents"
"github.com/cloudevents/sdk-go/legacy/pkg/cloudevents/types"
ce "github.com/cloudevents/sdk-go/v1/cloudevents"
"github.com/cloudevents/sdk-go/v1/cloudevents/types"
)

// Kind is a version-independent identifier for a CloudEvent context attribute.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"testing"
"time"

"github.com/cloudevents/sdk-go/legacy/pkg/binding/spec"
"github.com/cloudevents/sdk-go/v1/binding/spec"
"github.com/google/go-cmp/cmp"
"github.com/stretchr/testify/assert"
)
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions legacy/pkg/binding/spec/spec.go → v1/binding/spec/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"strings"

ce "github.com/cloudevents/sdk-go/legacy/pkg/cloudevents"
"github.com/cloudevents/sdk-go/legacy/pkg/cloudevents/types"
ce "github.com/cloudevents/sdk-go/v1/cloudevents"
"github.com/cloudevents/sdk-go/v1/cloudevents/types"
)

// Version provides meta-data for a single spec-version.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package spec_test
import (
"testing"

"github.com/cloudevents/sdk-go/legacy/pkg/binding/spec"
ce "github.com/cloudevents/sdk-go/legacy/pkg/cloudevents"
"github.com/cloudevents/sdk-go/v1/binding/spec"
ce "github.com/cloudevents/sdk-go/v1/cloudevents"
"github.com/stretchr/testify/assert"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/stretchr/testify/assert"
"golang.org/x/sync/errgroup"

"github.com/cloudevents/sdk-go/legacy/pkg/binding"
"github.com/cloudevents/sdk-go/v1/binding"
)

// Simple send/receive benchmark.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"reflect"
"time"

"github.com/cloudevents/sdk-go/legacy/pkg/binding/spec"
ce "github.com/cloudevents/sdk-go/legacy/pkg/cloudevents"
"github.com/cloudevents/sdk-go/legacy/pkg/cloudevents/types"
"github.com/cloudevents/sdk-go/v1/binding/spec"
ce "github.com/cloudevents/sdk-go/v1/cloudevents"
"github.com/cloudevents/sdk-go/v1/cloudevents/types"
)

func strptr(s string) *string { return &s }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"io"
"io/ioutil"

cloudevents "github.com/cloudevents/sdk-go/legacy"
"github.com/cloudevents/sdk-go/legacy/pkg/binding"
"github.com/cloudevents/sdk-go/legacy/pkg/binding/spec"
cloudevents "github.com/cloudevents/sdk-go/v1"
"github.com/cloudevents/sdk-go/v1/binding"
"github.com/cloudevents/sdk-go/v1/binding/spec"
)

// MockBinaryMessage implements a binary-mode message as a simple struct.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"io"
"io/ioutil"

cloudevents "github.com/cloudevents/sdk-go/legacy"
"github.com/cloudevents/sdk-go/legacy/pkg/binding"
"github.com/cloudevents/sdk-go/legacy/pkg/binding/format"
cloudevents "github.com/cloudevents/sdk-go/v1"
"github.com/cloudevents/sdk-go/v1/binding"
"github.com/cloudevents/sdk-go/v1/binding/format"
)

// MockStructuredMessage implements a structured-mode message as a simple struct.
Expand Down
12 changes: 6 additions & 6 deletions legacy/pkg/binding/test/test.go → v1/binding/test/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

cloudevents "github.com/cloudevents/sdk-go/legacy"
"github.com/cloudevents/sdk-go/legacy/pkg/binding"
"github.com/cloudevents/sdk-go/legacy/pkg/binding/format"
"github.com/cloudevents/sdk-go/legacy/pkg/binding/spec"
ce "github.com/cloudevents/sdk-go/legacy/pkg/cloudevents"
"github.com/cloudevents/sdk-go/legacy/pkg/cloudevents/types"
cloudevents "github.com/cloudevents/sdk-go/v1"
"github.com/cloudevents/sdk-go/v1/binding"
"github.com/cloudevents/sdk-go/v1/binding/format"
"github.com/cloudevents/sdk-go/v1/binding/spec"
ce "github.com/cloudevents/sdk-go/v1/cloudevents"
"github.com/cloudevents/sdk-go/v1/cloudevents/types"
)

// NameOf generates a string test name from x, esp. for ce.Event and ce.Message.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (

"github.com/stretchr/testify/assert"

"github.com/cloudevents/sdk-go/legacy/pkg/binding"
"github.com/cloudevents/sdk-go/legacy/pkg/binding/test"
"github.com/cloudevents/sdk-go/v1/binding"
"github.com/cloudevents/sdk-go/v1/binding/test"
)

func TestEvent(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (

"github.com/stretchr/testify/require"

cloudevents "github.com/cloudevents/sdk-go/legacy"
"github.com/cloudevents/sdk-go/legacy/pkg/binding"
cloudevents "github.com/cloudevents/sdk-go/v1"
"github.com/cloudevents/sdk-go/v1/binding"
)

type TranscoderTestArgs struct {
Expand Down
Loading

0 comments on commit 0a5202b

Please sign in to comment.