Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for rename and go.mod support #461

Merged
merged 1 commit into from
May 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ sudo: false
go:
- 1.12.x
- 1.11.x
go_import_path: github.com/nats-io/go-nats
go_import_path: github.com/nats-io/nats.go
install:
- go get -t ./...
- go get github.com/nats-io/nats-server
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ A [Go](http://golang.org) client for the [NATS messaging system](https://nats.io

[![License Apache 2](https://img.shields.io/badge/License-Apache2-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fnats-io%2Fgo-nats.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fnats-io%2Fgo-nats?ref=badge_shield)
[![Go Report Card](https://goreportcard.com/badge/github.com/nats-io/go-nats)](https://goreportcard.com/report/github.com/nats-io/go-nats) [![Build Status](https://travis-ci.org/nats-io/go-nats.svg?branch=master)](http://travis-ci.org/nats-io/go-nats) [![GoDoc](https://godoc.org/github.com/nats-io/go-nats?status.svg)](http://godoc.org/github.com/nats-io/go-nats) [![Coverage Status](https://coveralls.io/repos/nats-io/go-nats/badge.svg?branch=master)](https://coveralls.io/r/nats-io/go-nats?branch=master)
[![Go Report Card](https://goreportcard.com/badge/github.com/nats-io/nats.go)](https://goreportcard.com/report/github.com/nats-io/nats.go) [![Build Status](https://travis-ci.org/nats-io/nats.go.svg?branch=master)](http://travis-ci.org/nats-io/nats.go) [![GoDoc](https://godoc.org/github.com/nats-io/nats.go?status.svg)](http://godoc.org/github.com/nats-io/nats.go) [![Coverage Status](https://coveralls.io/repos/nats-io/nats.go/badge.svg?branch=master)](https://coveralls.io/r/nats-io/nats.go?branch=master)

## Installation

```bash
# Go client
go get github.com/nats-io/go-nats
go get github.com/nats-io/nats.go

# Server
go get github.com/nats-io/nats-server
Expand All @@ -18,7 +18,7 @@ go get github.com/nats-io/nats-server
## Basic Usage

```go
import nats "github.com/nats-io/go-nats"
import nats "github.com/nats-io/nats.go"

// Connect to a server
nc, _ := nats.Connect(nats.DefaultURL)
Expand Down
4 changes: 2 additions & 2 deletions bench/bench.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2016-2018 The NATS Authors
// Copyright 2016-2019 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand All @@ -22,7 +22,7 @@ import (
"strconv"
"time"

"github.com/nats-io/go-nats"
"github.com/nats-io/nats.go"
"github.com/nats-io/nuid"
)

Expand Down
4 changes: 2 additions & 2 deletions bench/benchlib_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2016-2018 The NATS Authors
// Copyright 2016-2019 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand All @@ -19,7 +19,7 @@ import (
"testing"
"time"

"github.com/nats-io/go-nats"
"github.com/nats-io/nats.go"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions enc.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012-2018 The NATS Authors
// Copyright 2012-2019 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand All @@ -21,7 +21,7 @@ import (
"time"

// Default Encoders
"github.com/nats-io/go-nats/encoders/builtin"
"github.com/nats-io/nats.go/encoders/builtin"
)

// Encoder interface is for all register encoders
Expand Down
10 changes: 5 additions & 5 deletions enc_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012-2018 The NATS Authors
// Copyright 2012-2019 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand All @@ -18,17 +18,17 @@ import (
"testing"
"time"

. "github.com/nats-io/go-nats"
"github.com/nats-io/go-nats/encoders/protobuf"
"github.com/nats-io/go-nats/encoders/protobuf/testdata"
. "github.com/nats-io/nats.go"
"github.com/nats-io/nats.go/encoders/protobuf"
"github.com/nats-io/nats.go/encoders/protobuf/testdata"
)

// Since we import above nats packages, we need to have a different
// const name than TEST_PORT that we used on the other packages.
const ENC_TEST_PORT = 8268

var options = Options{
Url: fmt.Sprintf("nats://localhost:%d", ENC_TEST_PORT),
Url: fmt.Sprintf("nats://127.0.0.1:%d", ENC_TEST_PORT),
AllowReconnect: true,
MaxReconnect: 10,
ReconnectWait: 100 * time.Millisecond,
Expand Down
2 changes: 1 addition & 1 deletion encoders/protobuf/protobuf_enc.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"errors"

"github.com/golang/protobuf/proto"
"github.com/nats-io/go-nats"
"github.com/nats-io/nats.go"
)

// Additional index for registered Encoders.
Expand Down
4 changes: 2 additions & 2 deletions example_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012-2018 The NATS Authors
// Copyright 2012-2019 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand All @@ -17,7 +17,7 @@ import (
"fmt"
"time"

"github.com/nats-io/go-nats"
"github.com/nats-io/nats.go"
)

// Shows different ways to create a Conn
Expand Down
6 changes: 3 additions & 3 deletions examples/nats-bench/main.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2015-2018 The NATS Authors
// Copyright 2015-2019 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand All @@ -22,8 +22,8 @@ import (
"sync"
"time"

"github.com/nats-io/go-nats"
"github.com/nats-io/go-nats/bench"
"github.com/nats-io/nats.go"
"github.com/nats-io/nats.go/bench"
)

// Some sane defaults
Expand Down
4 changes: 2 additions & 2 deletions examples/nats-echo/main.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2018 The NATS Authors
// Copyright 2018-2019 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down Expand Up @@ -26,7 +26,7 @@ import (
"syscall"
"time"

"github.com/nats-io/go-nats"
"github.com/nats-io/nats.go"
)

// NOTE: Can test with demo servers.
Expand Down
4 changes: 2 additions & 2 deletions examples/nats-pub/main.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012-2018 The NATS Authors
// Copyright 2012-2019 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand All @@ -17,7 +17,7 @@ import (
"flag"
"log"

"github.com/nats-io/go-nats"
"github.com/nats-io/nats.go"
)

// NOTE: Can test with demo servers.
Expand Down
4 changes: 2 additions & 2 deletions examples/nats-qsub/main.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012-2018 The NATS Authors
// Copyright 2012-2019 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand All @@ -20,7 +20,7 @@ import (
"runtime"
"time"

"github.com/nats-io/go-nats"
"github.com/nats-io/nats.go"
)

// NOTE: Can test with demo servers.
Expand Down
6 changes: 3 additions & 3 deletions examples/nats-req/main.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012-2018 The NATS Authors
// Copyright 2012-2019 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand All @@ -18,7 +18,7 @@ import (
"log"
"time"

"github.com/nats-io/go-nats"
"github.com/nats-io/nats.go"
)

// NOTE: Can test with demo servers.
Expand Down Expand Up @@ -59,7 +59,7 @@ func main() {
defer nc.Close()
subj, payload := args[0], []byte(args[1])

msg, err := nc.Request(subj, []byte(payload), time.Second)
msg, err := nc.Request(subj, []byte(payload), 2*time.Second)
if err != nil {
if nc.LastError() != nil {
log.Fatalf("%v for request", nc.LastError())
Expand Down
4 changes: 2 additions & 2 deletions examples/nats-rply/main.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012-2018 The NATS Authors
// Copyright 2012-2019 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand All @@ -19,7 +19,7 @@ import (
"runtime"
"time"

"github.com/nats-io/go-nats"
"github.com/nats-io/nats.go"
)

// NOTE: Can test with demo servers.
Expand Down
4 changes: 2 additions & 2 deletions examples/nats-sub/main.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012-2018 The NATS Authors
// Copyright 2012-2019 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand All @@ -19,7 +19,7 @@ import (
"runtime"
"time"

"github.com/nats-io/go-nats"
"github.com/nats-io/nats.go"
)

// NOTE: Can test with demo servers.
Expand Down
13 changes: 13 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module github.com/nats-io/nats.go

require (
github.com/golang/protobuf v1.3.1
github.com/nats-io/nats-server v1.4.1
github.com/nats-io/nkeys v0.0.2
github.com/nats-io/nuid v1.0.1
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529 // indirect
golang.org/x/net v0.0.0-20190509222800-a4d6f7feada5 // indirect
golang.org/x/sys v0.0.0-20190509141414-a5b02f93d862 // indirect
golang.org/x/text v0.3.2 // indirect
golang.org/x/tools v0.0.0-20190510151030-63859f3815cb // indirect
)
25 changes: 25 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/nats-io/nats-server v1.4.1 h1:Ul1oSOGNV/L8kjr4v6l2f9Yet6WY+LevH1/7cRZ/qyA=
github.com/nats-io/nats-server v1.4.1/go.mod h1:c8f/fHd2B6Hgms3LtCaI7y6pC4WD1f4SUxcCud5vhBc=
github.com/nats-io/nkeys v0.0.2 h1:+qM7QpgXnvDDixitZtQUBDY9w/s9mu1ghS+JIbsrx6M=
github.com/nats-io/nkeys v0.0.2/go.mod h1:dab7URMsZm6Z/jp9Z5UGa87Uutgc2mVpXLC4B7TDb/4=
github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw=
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9 h1:mKdxBk7AujPs8kU4m80U72y/zjbZ3UcXC7dClwKbUI0=
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529 h1:iMGN4xG0cnqj3t+zOM8wUB0BiPKHEwSxEZCvzcbZuvk=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190509222800-a4d6f7feada5/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190509141414-a5b02f93d862 h1:rM0ROo5vb9AdYJi1110yjWGMej9ITfKddS89P3Fkhug=
golang.org/x/sys v0.0.0-20190509141414-a5b02f93d862/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190510151030-63859f3815cb/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
2 changes: 1 addition & 1 deletion nats.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import (
"sync/atomic"
"time"

"github.com/nats-io/go-nats/util"
"github.com/nats-io/nats.go/util"
"github.com/nats-io/nkeys"
"github.com/nats-io/nuid"
)
Expand Down
10 changes: 5 additions & 5 deletions nats_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012-2018 The NATS Authors
// Copyright 2012-2019 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down Expand Up @@ -104,7 +104,7 @@ func TestVersionMatchesTag(t *testing.T) {
const TEST_PORT = 8368

var reconnectOpts = Options{
Url: fmt.Sprintf("nats://localhost:%d", TEST_PORT),
Url: fmt.Sprintf("nats://127.0.0.1:%d", TEST_PORT),
AllowReconnect: true,
MaxReconnect: 10,
ReconnectWait: 100 * time.Millisecond,
Expand Down Expand Up @@ -1716,7 +1716,7 @@ func TestSubscribeSyncRace(t *testing.T) {
s := RunServerOnPort(TEST_PORT)
defer s.Shutdown()

nc, err := Connect(fmt.Sprintf("localhost:%d", TEST_PORT))
nc, err := Connect(fmt.Sprintf("127.0.0.1:%d", TEST_PORT))
if err != nil {
t.Fatalf("Error on connect: %v", err)
}
Expand All @@ -1742,11 +1742,11 @@ func BenchmarkNextMsgNoTimeout(b *testing.B) {
s := RunServerOnPort(TEST_PORT)
defer s.Shutdown()

ncp, err := Connect(fmt.Sprintf("localhost:%d", TEST_PORT))
ncp, err := Connect(fmt.Sprintf("127.0.0.1:%d", TEST_PORT))
if err != nil {
b.Fatalf("Error connecting: %v", err)
}
ncs, err := Connect(fmt.Sprintf("localhost:%d", TEST_PORT), SyncQueueLen(b.N))
ncs, err := Connect(fmt.Sprintf("127.0.0.1:%d", TEST_PORT), SyncQueueLen(b.N))
if err != nil {
b.Fatalf("Error connecting: %v", err)
}
Expand Down
6 changes: 3 additions & 3 deletions scripts/cov.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
rm -rf ./cov
mkdir cov
go test -v -race -covermode=atomic -coverprofile=./cov/nats.out
go test -v -race -covermode=atomic -coverprofile=./cov/test.out -coverpkg=github.com/nats-io/go-nats ./test
go test -v -race -covermode=atomic -coverprofile=./cov/builtin.out -coverpkg=github.com/nats-io/go-nats/encoders/builtin ./test -run EncBuiltin
go test -v -race -covermode=atomic -coverprofile=./cov/protobuf.out -coverpkg=github.com/nats-io/go-nats/encoders/protobuf ./test -run EncProto
go test -v -race -covermode=atomic -coverprofile=./cov/test.out -coverpkg=github.com/nats-io/nats.go ./test
go test -v -race -covermode=atomic -coverprofile=./cov/builtin.out -coverpkg=github.com/nats-io/nats.go/encoders/builtin ./test -run EncBuiltin
go test -v -race -covermode=atomic -coverprofile=./cov/protobuf.out -coverpkg=github.com/nats-io/nats.go/encoders/protobuf ./test -run EncProto
gocovmerge ./cov/*.out > acc.out
rm -rf ./cov

Expand Down
8 changes: 4 additions & 4 deletions staticcheck.ignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
github.com/nats-io/go-nats/*_test.go:SA2002
github.com/nats-io/go-nats/*/*_test.go:SA2002
github.com/nats-io/go-nats/test/context_test.go:SA1012
github.com/nats-io/go-nats/nats.go:SA6000
github.com/nats-io/nats.go/*_test.go:SA2002
github.com/nats-io/nats.go/*/*_test.go:SA2002
github.com/nats-io/nats.go/test/context_test.go:SA1012
github.com/nats-io/nats.go/nats.go:SA6000
Loading