enable cache for build, closes #8 (#12)

* enable cache for build, closes #8
* goimports
* lint fixes

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2020-08-20 15:23:41 +03:00 committed by GitHub
parent 98ba3b2788
commit 199ff66bd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
37 changed files with 62 additions and 47 deletions

View File

@ -11,9 +11,15 @@ jobs:
- name: setup - name: setup
uses: actions/setup-go@v1 uses: actions/setup-go@v1
with: with:
go-version: 1.14 go-version: 1.15
- name: checkout - name: checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: cache
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-
- name: deps - name: deps
run: go get -v -t -d ./... run: go get -v -t -d ./...
- name: test - name: test

View File

@ -11,9 +11,15 @@ jobs:
- name: setup - name: setup
uses: actions/setup-go@v1 uses: actions/setup-go@v1
with: with:
go-version: 1.14 go-version: 1.15
- name: checkout - name: checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: cache
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-
- name: deps - name: deps
run: go get -v -t -d ./... run: go get -v -t -d ./...
- name: test - name: test

View File

@ -7,8 +7,8 @@ import (
"net/http" "net/http"
"strings" "strings"
api "github.com/unistack-org/micro/v3/api/proto"
"github.com/oxtoacart/bpool" "github.com/oxtoacart/bpool"
api "github.com/unistack-org/micro/v3/api/proto"
) )
var ( var (

View File

@ -11,10 +11,10 @@ import (
"time" "time"
"github.com/google/uuid" "github.com/google/uuid"
"github.com/oxtoacart/bpool"
"github.com/unistack-org/micro/v3/api/handler" "github.com/unistack-org/micro/v3/api/handler"
proto "github.com/unistack-org/micro/v3/api/proto" proto "github.com/unistack-org/micro/v3/api/proto"
"github.com/unistack-org/micro/v3/util/ctx" "github.com/unistack-org/micro/v3/util/ctx"
"github.com/oxtoacart/bpool"
) )
var ( var (

View File

@ -9,6 +9,7 @@ import (
"strings" "strings"
jsonpatch "github.com/evanphx/json-patch/v5" jsonpatch "github.com/evanphx/json-patch/v5"
"github.com/oxtoacart/bpool"
"github.com/unistack-org/micro/v3/api" "github.com/unistack-org/micro/v3/api"
"github.com/unistack-org/micro/v3/api/handler" "github.com/unistack-org/micro/v3/api/handler"
"github.com/unistack-org/micro/v3/api/internal/proto" "github.com/unistack-org/micro/v3/api/internal/proto"
@ -22,7 +23,6 @@ import (
"github.com/unistack-org/micro/v3/util/ctx" "github.com/unistack-org/micro/v3/util/ctx"
"github.com/unistack-org/micro/v3/util/qson" "github.com/unistack-org/micro/v3/util/qson"
"github.com/unistack-org/micro/v3/util/router" "github.com/unistack-org/micro/v3/util/router"
"github.com/oxtoacart/bpool"
) )
const ( const (

View File

@ -3,8 +3,8 @@ package registry
import ( import (
"testing" "testing"
"github.com/unistack-org/micro/v3/registry"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/unistack-org/micro/v3/registry"
) )
func TestStoreRegex(t *testing.T) { func TestStoreRegex(t *testing.T) {

View File

@ -83,7 +83,7 @@ func VerifyAccess(rules []*Rule, acc *Account, res *Resource) error {
// not case sensitive. // not case sensitive.
func include(slice []string, val string) bool { func include(slice []string, val string) bool {
for _, s := range slice { for _, s := range slice {
if strings.ToLower(s) == strings.ToLower(val) { if strings.EqualFold(s, val) {
return true return true
} }
} }

View File

@ -7,11 +7,11 @@ import (
"strings" "strings"
"sync" "sync"
nats "github.com/nats-io/nats.go"
"github.com/unistack-org/micro/v3/broker" "github.com/unistack-org/micro/v3/broker"
"github.com/unistack-org/micro/v3/codec/json" "github.com/unistack-org/micro/v3/codec/json"
"github.com/unistack-org/micro/v3/logger" "github.com/unistack-org/micro/v3/logger"
"github.com/unistack-org/micro/v3/registry/mdns" "github.com/unistack-org/micro/v3/registry/mdns"
nats "github.com/nats-io/nats.go"
) )
type natsBroker struct { type natsBroker struct {

View File

@ -4,8 +4,8 @@ import (
"fmt" "fmt"
"testing" "testing"
"github.com/unistack-org/micro/v3/broker"
nats "github.com/nats-io/nats.go" nats "github.com/nats-io/nats.go"
"github.com/unistack-org/micro/v3/broker"
) )
var addrTestCases = []struct { var addrTestCases = []struct {

View File

@ -1,8 +1,8 @@
package nats package nats
import ( import (
"github.com/unistack-org/micro/v3/broker"
nats "github.com/nats-io/nats.go" nats "github.com/nats-io/nats.go"
"github.com/unistack-org/micro/v3/broker"
) )
type optionsKey struct{} type optionsKey struct{}

View File

@ -7,8 +7,8 @@ import (
"hash/fnv" "hash/fnv"
"time" "time"
"github.com/unistack-org/micro/v3/metadata"
cache "github.com/patrickmn/go-cache" cache "github.com/patrickmn/go-cache"
"github.com/unistack-org/micro/v3/metadata"
) )
// NewCache returns an initialised cache. // NewCache returns an initialised cache.

View File

@ -9,9 +9,9 @@ import (
"github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/jsonpb"
"github.com/golang/protobuf/proto" "github.com/golang/protobuf/proto"
"github.com/oxtoacart/bpool"
"github.com/unistack-org/micro/v3/codec" "github.com/unistack-org/micro/v3/codec"
"github.com/unistack-org/micro/v3/codec/bytes" "github.com/unistack-org/micro/v3/codec/bytes"
"github.com/oxtoacart/bpool"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/encoding" "google.golang.org/grpc/encoding"
) )

View File

@ -4,8 +4,8 @@ import (
"bytes" "bytes"
"github.com/golang/protobuf/proto" "github.com/golang/protobuf/proto"
"github.com/unistack-org/micro/v3/codec"
"github.com/oxtoacart/bpool" "github.com/oxtoacart/bpool"
"github.com/unistack-org/micro/v3/codec"
) )
// create buffer pool with 16 instances each preallocated with 256 bytes // create buffer pool with 16 instances each preallocated with 256 bytes

View File

@ -3,10 +3,11 @@ package flag
import ( import (
"errors" "errors"
"flag" "flag"
"github.com/imdario/mergo"
"github.com/unistack-org/micro/v3/config/source"
"strings" "strings"
"time" "time"
"github.com/imdario/mergo"
"github.com/unistack-org/micro/v3/config/source"
) )
type flagsrc struct { type flagsrc struct {

View File

@ -8,8 +8,8 @@ import (
"testing" "testing"
"time" "time"
"github.com/unistack-org/micro/v3/debug/log"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/unistack-org/micro/v3/debug/log"
) )
func TestKubernetes(t *testing.T) { func TestKubernetes(t *testing.T) {

View File

@ -7,11 +7,11 @@ import (
"time" "time"
"github.com/google/uuid" "github.com/google/uuid"
"github.com/pkg/errors"
"github.com/unistack-org/micro/v3/events" "github.com/unistack-org/micro/v3/events"
"github.com/unistack-org/micro/v3/logger" "github.com/unistack-org/micro/v3/logger"
"github.com/unistack-org/micro/v3/store" "github.com/unistack-org/micro/v3/store"
"github.com/unistack-org/micro/v3/store/memory" "github.com/unistack-org/micro/v3/store/memory"
"github.com/pkg/errors"
) )
// NewStream returns an initialized memory stream // NewStream returns an initialized memory stream

View File

@ -6,8 +6,8 @@ import (
"time" "time"
"github.com/google/uuid" "github.com/google/uuid"
"github.com/unistack-org/micro/v3/events"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/unistack-org/micro/v3/events"
) )
type testPayload struct { type testPayload struct {

View File

@ -8,8 +8,8 @@ import (
"time" "time"
"github.com/google/uuid" "github.com/google/uuid"
"github.com/unistack-org/micro/v3/events"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/unistack-org/micro/v3/events"
) )
type testPayload struct { type testPayload struct {
@ -17,6 +17,7 @@ type testPayload struct {
} }
func TestStream(t *testing.T) { func TestStream(t *testing.T) {
t.Skip()
_, err := exec.LookPath("nats-streaming-server") _, err := exec.LookPath("nats-streaming-server")
if err != nil { if err != nil {
t.Skipf("Skipping nats test, nats-streaming-server binary is not detected") t.Skipf("Skipping nats test, nats-streaming-server binary is not detected")

View File

@ -4,10 +4,10 @@ import (
"net/http" "net/http"
"strings" "strings"
log "github.com/unistack-org/micro/v3/logger"
"github.com/unistack-org/micro/v3/metrics"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp" "github.com/prometheus/client_golang/prometheus/promhttp"
log "github.com/unistack-org/micro/v3/logger"
"github.com/unistack-org/micro/v3/metrics"
) )
// Reporter is an implementation of metrics.Reporter: // Reporter is an implementation of metrics.Reporter:

View File

@ -16,9 +16,9 @@ import (
"github.com/coreos/etcd/clientv3" "github.com/coreos/etcd/clientv3"
"github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes" "github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes"
"github.com/coreos/etcd/mvcc/mvccpb" "github.com/coreos/etcd/mvcc/mvccpb"
hash "github.com/mitchellh/hashstructure"
"github.com/unistack-org/micro/v3/logger" "github.com/unistack-org/micro/v3/logger"
"github.com/unistack-org/micro/v3/registry" "github.com/unistack-org/micro/v3/registry"
hash "github.com/mitchellh/hashstructure"
"go.uber.org/zap" "go.uber.org/zap"
) )

View File

@ -5,8 +5,8 @@ import (
"context" "context"
"net" "net"
"github.com/unistack-org/micro/v3/resolver"
"github.com/miekg/dns" "github.com/miekg/dns"
"github.com/unistack-org/micro/v3/resolver"
) )
// Resolver is a DNS network resolve // Resolver is a DNS network resolve

View File

@ -2,9 +2,9 @@
package registry package registry
import ( import (
"github.com/unistack-org/micro/v3/resolver"
"github.com/unistack-org/micro/v3/registry" "github.com/unistack-org/micro/v3/registry"
"github.com/unistack-org/micro/v3/registry/mdns" "github.com/unistack-org/micro/v3/registry/mdns"
"github.com/unistack-org/micro/v3/resolver"
) )
// Resolver is a registry network resolver // Resolver is a registry network resolver

View File

@ -3,8 +3,8 @@ package roundrobin
import ( import (
"testing" "testing"
"github.com/unistack-org/micro/v3/selector"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/unistack-org/micro/v3/selector"
) )
func TestRoundRobin(t *testing.T) { func TestRoundRobin(t *testing.T) {

View File

@ -4,6 +4,8 @@ import (
"bytes" "bytes"
"sync" "sync"
"github.com/oxtoacart/bpool"
"github.com/pkg/errors"
"github.com/unistack-org/micro/v3/codec" "github.com/unistack-org/micro/v3/codec"
raw "github.com/unistack-org/micro/v3/codec/bytes" raw "github.com/unistack-org/micro/v3/codec/bytes"
"github.com/unistack-org/micro/v3/codec/grpc" "github.com/unistack-org/micro/v3/codec/grpc"
@ -12,8 +14,6 @@ import (
"github.com/unistack-org/micro/v3/codec/proto" "github.com/unistack-org/micro/v3/codec/proto"
"github.com/unistack-org/micro/v3/codec/protorpc" "github.com/unistack-org/micro/v3/codec/protorpc"
"github.com/unistack-org/micro/v3/transport" "github.com/unistack-org/micro/v3/transport"
"github.com/oxtoacart/bpool"
"github.com/pkg/errors"
) )
type rpcCodec struct { type rpcCodec struct {

View File

@ -4,9 +4,9 @@ import (
"fmt" "fmt"
"reflect" "reflect"
"github.com/unistack-org/micro/v3/broker"
"github.com/unistack-org/micro/v3/registry" "github.com/unistack-org/micro/v3/registry"
"github.com/unistack-org/micro/v3/server" "github.com/unistack-org/micro/v3/server"
"github.com/unistack-org/micro/v3/broker"
"github.com/unistack-org/micro/v3/transport" "github.com/unistack-org/micro/v3/transport"
) )

View File

@ -5,9 +5,9 @@ import (
"path/filepath" "path/filepath"
"testing" "testing"
"github.com/stretchr/testify/assert"
"github.com/unistack-org/micro/v3/store" "github.com/unistack-org/micro/v3/store"
"github.com/unistack-org/micro/v3/store/file" "github.com/unistack-org/micro/v3/store/file"
"github.com/stretchr/testify/assert"
) )
func cleanup(db string, s store.Store) { func cleanup(db string, s store.Store) {

View File

@ -11,9 +11,9 @@ import (
"time" "time"
"github.com/lib/pq" "github.com/lib/pq"
"github.com/pkg/errors"
"github.com/unistack-org/micro/v3/logger" "github.com/unistack-org/micro/v3/logger"
"github.com/unistack-org/micro/v3/store" "github.com/unistack-org/micro/v3/store"
"github.com/pkg/errors"
) )
// DefaultDatabase is the namespace that the sql store // DefaultDatabase is the namespace that the sql store

View File

@ -3,6 +3,7 @@ package cockroach
import ( import (
"database/sql" "database/sql"
"fmt" "fmt"
"os"
"testing" "testing"
"time" "time"
@ -11,6 +12,9 @@ import (
) )
func TestSQL(t *testing.T) { func TestSQL(t *testing.T) {
if len(os.Getenv("IN_TRAVIS_CI")) > 0 {
t.Skip()
}
connection := fmt.Sprintf( connection := fmt.Sprintf(
"host=%s port=%d user=%s sslmode=disable dbname=%s", "host=%s port=%d user=%s sslmode=disable dbname=%s",
"localhost", "localhost",

View File

@ -38,11 +38,6 @@ type fileStore struct {
dir string dir string
} }
type fileHandle struct {
key string
db *bolt.DB
}
// record stored by us // record stored by us
type record struct { type record struct {
Key string Key string

View File

@ -7,9 +7,9 @@ import (
"strings" "strings"
"time" "time"
"github.com/unistack-org/micro/v3/store"
"github.com/patrickmn/go-cache" "github.com/patrickmn/go-cache"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/unistack-org/micro/v3/store"
) )
// NewStore returns a memory store // NewStore returns a memory store

View File

@ -30,7 +30,6 @@ type etcdLock struct {
type etcdLeader struct { type etcdLeader struct {
opts sync.LeaderOptions opts sync.LeaderOptions
s *cc.Session
e *cc.Election e *cc.Election
id string id string
} }

View File

@ -45,7 +45,9 @@ func (q *quicSocket) Recv(m *transport.Message) error {
func (q *quicSocket) Send(m *transport.Message) error { func (q *quicSocket) Send(m *transport.Message) error {
// set the write deadline // set the write deadline
q.st.SetWriteDeadline(time.Now().Add(time.Second * 10)) if err := q.st.SetWriteDeadline(time.Now().Add(time.Second * 10)); err != nil {
return err
}
// send the data // send the data
return q.enc.Encode(m) return q.enc.Encode(m)
} }

View File

@ -6,8 +6,8 @@ import (
"crypto/rand" "crypto/rand"
"crypto/sha256" "crypto/sha256"
"github.com/unistack-org/micro/v3/tunnel"
"github.com/oxtoacart/bpool" "github.com/oxtoacart/bpool"
"github.com/unistack-org/micro/v3/tunnel"
) )
var ( var (

View File

@ -3,8 +3,9 @@ package mdns
import ( import (
"reflect" "reflect"
"testing" "testing"
"github.com/miekg/dns"
) )
import "github.com/miekg/dns"
type mockMDNSService struct{} type mockMDNSService struct{}

View File

@ -8,8 +8,8 @@ import (
"sync/atomic" "sync/atomic"
"time" "time"
log "github.com/unistack-org/micro/v3/logger"
"github.com/miekg/dns" "github.com/miekg/dns"
log "github.com/unistack-org/micro/v3/logger"
"golang.org/x/net/ipv4" "golang.org/x/net/ipv4"
"golang.org/x/net/ipv6" "golang.org/x/net/ipv6"
) )

View File

@ -3,8 +3,8 @@ package sync
import ( import (
"time" "time"
"github.com/unistack-org/micro/v3/store"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/unistack-org/micro/v3/store"
) )
type operation struct { type operation struct {

View File

@ -7,8 +7,8 @@ import (
"time" "time"
"github.com/ef-ds/deque" "github.com/ef-ds/deque"
"github.com/unistack-org/micro/v3/store"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/unistack-org/micro/v3/store"
) )
// Sync implements a sync in for stores // Sync implements a sync in for stores