Skip to content

Commit

Permalink
init 初始化
Browse files Browse the repository at this point in the history
  • Loading branch information
s00s committed Jan 19, 2021
0 parents commit 06d5b69
Show file tree
Hide file tree
Showing 76 changed files with 6,112 additions and 0 deletions.
164 changes: 164 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@

# Created by https://www.gitignore.io/api/jetbrains+all,macos,linux,windows
# Edit at https://www.gitignore.io/?templates=jetbrains+all,macos,linux,windows

### JetBrains+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### JetBrains+all Patch ###
# Ignores the whole .idea folder and all .iml files
# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360

.idea/

# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023

*.iml
modules.xml
.idea/misc.xml
*.ipr

# Sonarlint plugin
.idea/sonarlint

### Linux ###
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### Windows ###
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

# End of https://www.gitignore.io/api/jetbrains+all,macos,linux,windows
# 公共库不提交 vendor
/vendor
.vscode
*.test
74 changes: 74 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
linters-settings:
errcheck:
check-type-assertions: false
check-blank: false
govet:
check-shadowing: true
golint:
min-confidence: 0.8
exclude:
- ALL_CAPS
gocyclo:
min-complexity: 10
maligned:
suggest-new: true
goconst:
min-len: 3
min-occurrences: 3
# misspell:
# locale: US
lll:
line-length: 140
unparam:
check-exported: false
goimports:
local-prefixes: ylink
gocritic:
enabled-tags:
- performance
- style
- experimental
disabled-checks:
- commentedOutCode
- wrapperFunc
- paramTypeCombine
- elseif
- hugeParam
# - dupImport # https://github.com/go-critic/go-critic/issues/845

run:
skip-dirs:
- design
- gen
- cmd/app
skip-files:
- ".*\\.mock\\.go$"
# modules-download-mode: readonly
tests: true

linters:
enable-all: false
fast: false
enable:
- deadcode
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- structcheck
- typecheck
- unused
- varcheck
- errorlint
# - wsl
- dogsled
- gofmt
- goimports
- lll
# - nestif
# - goconst

issues:
exclude:
- "don't use ((underscores)|(ALL_CAPS)) in Go names;"
27 changes: 27 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# workdir info
PACKAGE=go-libs
PREFIX=$(shell pwd)

# which golint
GOLINT=$(shell which golangci-lint || echo '')

# build args
BUILD_ARGS :=
EXTRA_BUILD_ARGS=

export GOCACHE=

.PONY: lint test
default: lint test

lint:
@echo "+ $@"
@$(if $(GOLINT), , \
$(error Please install golint: `go get -u github.com/golangci/golangci-lint/cmd/golangci-lint`))
golangci-lint run ./...

test:
@echo "+ test"
go test -cover $(EXTRA_BUILD_ARGS) ./...


11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# go-libs

一些通用 go-libs, 方便项目间复用

# how to

- go mod 使用私有仓库

```bash
$ git config --global url."https://s00s:d33b332426f2e787594ec32ceef090c45ad4934d@github.com".insteadOf "https://github.com"
```
48 changes: 48 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
module github.com/geeksmy/go-libs

go 1.15

require (
github.com/DATA-DOG/go-sqlmock v1.5.0
github.com/ajg/form v1.5.1
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/go-redis/redis/v7 v7.4.0
github.com/golang/mock v1.4.4
github.com/google/go-cmp v0.5.1 // indirect
github.com/google/uuid v1.1.2
github.com/jinzhu/gorm v1.9.16
github.com/labstack/echo/v4 v4.1.17
github.com/labstack/gommon v0.3.0
github.com/lib/pq v1.8.0 // indirect
github.com/magiconair/properties v1.8.2 // indirect
github.com/mitchellh/mapstructure v1.3.3 // indirect
github.com/nats-io/nats-server/v2 v2.1.9 // indirect
github.com/nats-io/nats.go v1.10.0
github.com/pelletier/go-toml v1.8.0 // indirect
github.com/prometheus/client_golang v1.7.1
github.com/smartystreets/goconvey v1.6.4
github.com/speps/go-hashids v2.0.0+incompatible
github.com/spf13/afero v1.3.5 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.7.1
github.com/stretchr/testify v1.6.1
go.uber.org/zap v1.16.0
goa.design/goa/v3 v3.2.3
golang.org/x/lint v0.0.0-20200302205851-738671d3881b // indirect
golang.org/x/net v0.0.0-20200904194848-62affa334b73 // indirect
golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f // indirect
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d // indirect
google.golang.org/grpc v1.31.1
gopkg.in/ini.v1 v1.61.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 // indirect
gorm.io/driver/mysql v1.0.1
gorm.io/driver/postgres v1.0.0
gorm.io/gorm v1.20.1
gotest.tools v2.2.0+incompatible
honnef.co/go/tools v0.0.1-2020.1.4 // indirect
)
Loading

0 comments on commit 06d5b69

Please sign in to comment.