-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
import-format.sh
37 lines (26 loc) · 1.25 KB
/
import-format.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
# Copyright Url-Shortenter Author(https://houseme.github.io/url-shortenter/). All Rights Reserved.
#
# This Source Code Form is subject to the terms of the MIT License.
# If a copy of the MIT was not distributed with this file,
# You can obtain one at https://github.com/houseme/url-shortenter.
#
# 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.
# 格式化 go.mod
go mod tidy -compat=1.18
# 处理 go imports 的格式化
rm -rf style_tool
rm -rf goimports-reviser
mkdir -p style_tool
cd style_tool
wget https://github.com/incu6us/goimports-reviser/releases/download/v3.6.4/goimports-reviser_3.6.4_linux_amd64.tar.gz
tar -zxvf goimports-reviser_3.6.4_linux_amd64.tar.gz
mv goimports-reviser ../
cd ../
ls -lstrh
find . -name "*.go" -type f | grep -v examples | grep -v .pb.go|grep -v test/tools/tools.go | grep -v ./plugin_register_generate.go | xargs -I {} goimports-reviser -rm-unused -format {} -project-name github.com/houseme/url-shortenter
# 处理 go 代码格式化
go fmt ./...