-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1c2367c
commit 9834527
Showing
27 changed files
with
1,862 additions
and
208 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,4 +21,5 @@ header: | |
- '**/*.go' | ||
paths-ignore: | ||
- example/hello/** | ||
- v2/example/hello/** | ||
comment: on-failure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,22 @@ | ||
NACOS_VERSION ?= 2.0.3 | ||
TOOLS_SHELL="./hack/tools.sh" | ||
|
||
prepare: | ||
docker pull nacos/nacos-server:$(NACOS_VERSION) | ||
docker run --rm --name nacos-quick -e MODE=standalone -p 8848:8848 -p 9848:9848 -d nacos/nacos-server:$(NACOS_VERSION) | ||
|
||
stop: | ||
docker stop nacos-quick | ||
|
||
|
||
.PHONY: test | ||
test: | ||
@${TOOLS_SHELL} test | ||
@echo "go test finished" | ||
|
||
|
||
|
||
.PHONY: vet | ||
vet: | ||
@${TOOLS_SHELL} vet | ||
@echo "vet check finished" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env bash | ||
|
||
# This is used by the linter action. | ||
# Recursively finds all directories with a go.mod file and creates | ||
# a GitHub Actions JSON output option. | ||
|
||
set -o errexit | ||
|
||
HOME=$( | ||
cd "$(dirname "${BASH_SOURCE[0]}")" && | ||
cd .. && | ||
pwd | ||
) | ||
|
||
source "${HOME}/hack/util.sh" | ||
all_modules=$(util::find_modules) | ||
PATHS="" | ||
for mod in $all_modules; do | ||
PATHS+=$(printf '{"workdir":"%s"},' ${mod}) | ||
done | ||
|
||
echo "::set-output name=matrix::{\"include\":[${PATHS%?}]}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
HOME=$( | ||
cd "$(dirname "${BASH_SOURCE[0]}")" && | ||
cd .. && | ||
pwd | ||
) | ||
|
||
source "${HOME}/hack/util.sh" | ||
|
||
all_modules=$(util::find_modules) | ||
|
||
# test all mod | ||
function test() { | ||
for mod in $all_modules; do | ||
pushd "$mod" >/dev/null && | ||
echo "go test $(sed -n 1p go.mod | cut -d ' ' -f2)" && | ||
go test -race -covermode=atomic -coverprofile=coverage.out ./... | ||
popd >/dev/null || exit | ||
done | ||
} | ||
|
||
# vet all mod | ||
function vet() { | ||
for mod in $all_modules; do | ||
pushd "$mod" >/dev/null && | ||
echo "go vet $(sed -n 1p go.mod | cut -d ' ' -f2)" && | ||
go vet -stdmethods=false ./... | ||
popd >/dev/null || exit | ||
done | ||
} | ||
|
||
function help() { | ||
echo "use: test,vet" | ||
} | ||
|
||
case $1 in | ||
vet) | ||
vet | ||
;; | ||
test) | ||
test | ||
;; | ||
*) | ||
help | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env bash | ||
|
||
# find all go mod path | ||
# returns an array contains mod path | ||
function util::find_modules() { | ||
find . -not \( \ | ||
\( \ | ||
-path './output' \ | ||
-o -path './.git' \ | ||
-o -path '*/third_party/*' \ | ||
-o -path '*/vendor/*' \ | ||
-o -path '*/example/*' \ | ||
\) -prune \ | ||
\) -name 'go.mod' -print0 | xargs -0 -I {} dirname {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
NACOS_VERSION ?= 2.0.3 | ||
TOOLS_SHELL="./hack/tools.sh" | ||
|
||
prepare: | ||
docker pull nacos/nacos-server:$(NACOS_VERSION) | ||
docker run --rm --name nacos-quick -e MODE=standalone -p 8848:8848 -p 9848:9848 -d nacos/nacos-server:$(NACOS_VERSION) | ||
|
||
stop: | ||
docker stop nacos-quick |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright 2021 CloudWeGo 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 | ||
// | ||
// 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. | ||
// | ||
|
||
namespace go api | ||
|
||
struct Request { | ||
1: string message | ||
} | ||
|
||
struct Response { | ||
1: string message | ||
} | ||
|
||
service Hello { | ||
Response echo(1: Request req) | ||
} |
Oops, something went wrong.