Proper licensing and linting

上级 d6a7fff1
......@@ -17,6 +17,5 @@ jobs:
executor: build
steps:
- checkout
- run: go get -u golang.org/x/lint/golint
- run: make vet
- run: make test
- run: make lint
......@@ -4,6 +4,7 @@
*.dll
*.so
*.dylib
bin/
# Test binary, build with `go test -c`
*.test
......
......@@ -9,15 +9,6 @@ GRPC_PATH := $(GO2SKY_GO)/reporter/grpc
test:
go test -v -race -cover ./...
.PHONY: lint
lint:
# Ignore grep's exit code since no match returns 1.
echo 'linting...' ; golint ./...
.PHONY: vet
vet:
go vet ./...
.PHONY: proto-gen
proto-gen:
cd $(GRPC_PATH) && \
......@@ -37,7 +28,14 @@ mock-gen:
mkdir -p mock_trace && \
mockgen github.com/tetratelabs/go2sky/reporter/grpc/language-agent-v2 TraceSegmentReportServiceClient > mock_trace/trace.mock.go
.PHONY: all
all: vet lint test
LINTER := bin/golangci-lint
$(LINTER):
wget -q -O- https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.13
.PHONY: example
.PHONY: lint
lint: $(LINTER) ./golangci.yml ## Run the linters
@echo "linting..."
$(LINTER) run --config ./golangci.yml
.PHONY: all
all: test lint
The source files contained in the reporter/grpc directory have been
taken from:
Apache SkyWalking
Copyright 2017-2019 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/)
......@@ -2,8 +2,8 @@
[![CircleCI](https://circleci.com/gh/tetratelabs/go2sky.svg?style=svg&circle-token=1336c221dca48dbfe15beb4242439fe41d2e755f)](https://circleci.com/gh/tetratelabs/go2sky)
**GO2Sky** is an intrument SDK library, writen in Go, by following [Apache SkyWalking](https://github.com/apache/incubator-skywalking) tracing and metric formats.
**GO2Sky** is an instrument SDK library, written in Go, by following [Apache SkyWalking](https://github.com/apache/incubator-skywalking) tracing and metric formats.
# License
Apache 2.0
This software is licensed under the Apache License 2.0. See [LICENSE](LICENSE) file for details.
// Copyright 2019 Tetrate Labs
//
// 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package go2sky_test
import (
"context"
"github.com/tetratelabs/go2sky"
"github.com/tetratelabs/go2sky/reporter"
"log"
"time"
"github.com/tetratelabs/go2sky"
"github.com/tetratelabs/go2sky/reporter"
)
func ExampleNewTracer() {
......
linters:
enable:
- deadcode
- errcheck
- goconst
- golint
- ineffassign
- lll
- maligned
- misspell
- structcheck
- unconvert
- varcheck
- govet
- goimports
- prealloc
- unused
- staticcheck
- gosimple
- megacheck
disable:
- interfacer
linters-settings:
lll:
line-length: 160
goconst:
min-occurrences: 4
govet:
check-shadowing: true
// Copyright 2019 Tetrate Labs
//
// 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package pkg
import (
......
// Copyright 2019 Tetrate Labs
//
// 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package pkg
import "time"
......
// Copyright 2019 Tetrate Labs
//
// 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package propagation
import (
"errors"
)
import "errors"
var (
errEmptyHeader = errors.New("empty header")
)
var errEmptyHeader = errors.New("empty header")
// DownstreamContext define the trace context from downstream
type DownstreamContext interface {
......
// Copyright 2019 Tetrate Labs
//
// 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package reporter
import (
"context"
"errors"
"github.com/golang/protobuf/proto"
"log"
"os"
"time"
"github.com/golang/protobuf/proto"
"google.golang.org/grpc"
"github.com/tetratelabs/go2sky"
......
// Copyright 2019 Tetrate Labs
//
// 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package reporter
import (
"fmt"
"github.com/golang/mock/gomock"
"github.com/tetratelabs/go2sky/reporter/grpc/common"
"github.com/tetratelabs/go2sky/reporter/grpc/register"
"github.com/tetratelabs/go2sky/reporter/grpc/register/mock_register"
"log"
"math/rand"
"os"
"testing"
"github.com/golang/mock/gomock"
"github.com/tetratelabs/go2sky/reporter/grpc/common"
"github.com/tetratelabs/go2sky/reporter/grpc/register"
"github.com/tetratelabs/go2sky/reporter/grpc/register/mock_register"
)
func Test_gRPCReporter_Register(t *testing.T) {
......
// Copyright 2019 Tetrate Labs
//
// 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package go2sky
import (
"github.com/tetratelabs/go2sky/pkg"
"sync/atomic"
"github.com/tetratelabs/go2sky/pkg"
)
func newSegmentSpan(defaultSpan *defaultSpan, parentSpan Span) Span {
......
// Copyright 2019 Tetrate Labs
//
// 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package go2sky
import (
......
// Copyright 2019 Tetrate Labs
//
// 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package go2sky
import (
......
// Copyright 2019 Tetrate Labs
//
// 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package go2sky
import "github.com/tetratelabs/go2sky/propagation"
......
// Copyright 2019 Tetrate Labs
//
// 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package go2sky
import (
"context"
"github.com/google/uuid"
"github.com/tetratelabs/go2sky/propagation"
)
......
// Copyright 2019 Tetrate Labs
//
// 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package go2sky
// WithReporter setup report pipeline for tracer
......
// Copyright 2019 Tetrate Labs
//
// 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package go2sky
import (
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册