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
uses: actions/setup-go@v1
with:
go-version: 1.14
go-version: 1.15
- name: checkout
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
run: go get -v -t -d ./...
- name: test

View File

@ -11,9 +11,15 @@ jobs:
- name: setup
uses: actions/setup-go@v1
with:
go-version: 1.14
go-version: 1.15
- name: checkout
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
run: go get -v -t -d ./...
- name: test

View File

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

View File

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

View File

@ -9,6 +9,7 @@ import (
"strings"
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/handler"
"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/qson"
"github.com/unistack-org/micro/v3/util/router"
"github.com/oxtoacart/bpool"
)
const (

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -4,10 +4,10 @@ import (
"net/http"
"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/promhttp"
log "github.com/unistack-org/micro/v3/logger"
"github.com/unistack-org/micro/v3/metrics"
)
// Reporter is an implementation of metrics.Reporter:

View File

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

View File

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

View File

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

View File

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

View File

@ -4,6 +4,8 @@ import (
"bytes"
"sync"
"github.com/oxtoacart/bpool"
"github.com/pkg/errors"
"github.com/unistack-org/micro/v3/codec"
raw "github.com/unistack-org/micro/v3/codec/bytes"
"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/protorpc"
"github.com/unistack-org/micro/v3/transport"
"github.com/oxtoacart/bpool"
"github.com/pkg/errors"
)
type rpcCodec struct {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -45,7 +45,9 @@ func (q *quicSocket) Recv(m *transport.Message) error {
func (q *quicSocket) Send(m *transport.Message) error {
// 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
return q.enc.Encode(m)
}

View File

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

View File

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

View File

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

View File

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

View File

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