migrate github gist
parent
a70966a8f3
commit
1a8569d0ec
|
@ -329,228 +329,6 @@ sudo pkill bluetoothd</pre
|
|||
>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="markdown-heading">
|
||||
<h2 class="heading-element"><code>.gitignore</code></h2>
|
||||
<a
|
||||
id="user-content-gitignore"
|
||||
class="anchor"
|
||||
aria-label="Permalink: .gitignore"
|
||||
href="#gitignore"
|
||||
><span aria-hidden="true" class="octicon octicon-link"></span
|
||||
></a>
|
||||
</div>
|
||||
<div class="highlight highlight-text-adblock">
|
||||
<pre><span class="pl-c"># macOS</span>
|
||||
.DS_Store
|
||||
|
||||
<span class="pl-c"># Window</span>
|
||||
<span class="pl-k">*</span>.exe
|
||||
|
||||
<span class="pl-c"># IntelliJ</span>
|
||||
.idea
|
||||
|
||||
<span class="pl-c"># VSCode</span>
|
||||
.vscode
|
||||
|
||||
<span class="pl-c"># Go</span>
|
||||
coverage.out
|
||||
vendor
|
||||
|
||||
<span class="pl-c"># GoReleaser</span>
|
||||
dist</pre>
|
||||
</div>
|
||||
<div class="markdown-heading">
|
||||
<h2 class="heading-element">GitHub Actions</h2>
|
||||
<a
|
||||
id="user-content-github-actions"
|
||||
class="anchor"
|
||||
aria-label="Permalink: GitHub Actions"
|
||||
href="#github-actions"
|
||||
><span aria-hidden="true" class="octicon octicon-link"></span
|
||||
></a>
|
||||
</div>
|
||||
<p><code>dependabot.yml</code>:</p>
|
||||
<div class="highlight highlight-source-yaml">
|
||||
<pre><span class="pl-ent">version</span>: <span class="pl-c1">2</span>
|
||||
<span class="pl-ent">updates</span>:
|
||||
- <span class="pl-ent">package-ecosystem</span>: <span class="pl-s"><span class="pl-pds">"</span>gomod<span class="pl-pds">"</span></span>
|
||||
<span class="pl-ent">directory</span>: <span class="pl-s"><span class="pl-pds">"</span>/<span class="pl-pds">"</span></span>
|
||||
<span class="pl-ent">schedule</span>:
|
||||
<span class="pl-ent">interval</span>: <span class="pl-s"><span class="pl-pds">"</span>daily<span class="pl-pds">"</span></span>
|
||||
- <span class="pl-ent">package-ecosystem</span>: <span class="pl-s"><span class="pl-pds">"</span>github-actions<span class="pl-pds">"</span></span>
|
||||
<span class="pl-ent">directory</span>: <span class="pl-s"><span class="pl-pds">"</span>/<span class="pl-pds">"</span></span>
|
||||
<span class="pl-ent">schedule</span>:
|
||||
<span class="pl-ent">interval</span>: <span class="pl-s"><span class="pl-pds">"</span>daily<span class="pl-pds">"</span></span></pre>
|
||||
</div>
|
||||
<p><code>go.yml</code>:</p>
|
||||
<div class="highlight highlight-source-yaml">
|
||||
<pre><span class="pl-ent">name</span>: <span class="pl-s">Go</span>
|
||||
|
||||
<span class="pl-ent">on</span>:
|
||||
<span class="pl-ent">push</span>:
|
||||
<span class="pl-ent">branches</span>:
|
||||
- <span class="pl-s">main</span>
|
||||
<span class="pl-ent">paths</span>:
|
||||
- <span class="pl-s"><span class="pl-pds">"</span>**.go<span class="pl-pds">"</span></span>
|
||||
- <span class="pl-s"><span class="pl-pds">"</span>go.mod<span class="pl-pds">"</span></span>
|
||||
- <span class="pl-s"><span class="pl-pds">"</span>go.sum<span class="pl-pds">"</span></span>
|
||||
<span class="pl-ent">pull_request</span>:
|
||||
<span class="pl-ent">branches</span>:
|
||||
- <span class="pl-s">main</span>
|
||||
<span class="pl-ent">paths</span>:
|
||||
- <span class="pl-s"><span class="pl-pds">"</span>**.go<span class="pl-pds">"</span></span>
|
||||
- <span class="pl-s"><span class="pl-pds">"</span>go.mod<span class="pl-pds">"</span></span>
|
||||
- <span class="pl-s"><span class="pl-pds">"</span>go.sum<span class="pl-pds">"</span></span>
|
||||
|
||||
<span class="pl-ent">concurrency</span>:
|
||||
<span class="pl-ent">group</span>: <span class="pl-s">${{ github.workflow }}-${{ github.ref }}</span>
|
||||
<span class="pl-ent">cancel-in-progress</span>: <span class="pl-c1">true</span>
|
||||
|
||||
<span class="pl-ent">jobs</span>:
|
||||
<span class="pl-ent">test</span>:
|
||||
<span class="pl-ent">name</span>: <span class="pl-s">Test</span>
|
||||
<span class="pl-ent">runs-on</span>: <span class="pl-s">ubuntu-latest</span>
|
||||
<span class="pl-ent">steps</span>:
|
||||
- <span class="pl-ent">uses</span>: <span class="pl-s">actions/checkout@v3</span>
|
||||
- <span class="pl-ent">uses</span>: <span class="pl-s">actions/setup-go@v4</span>
|
||||
<span class="pl-ent">with</span>:
|
||||
<span class="pl-ent">go-version</span>: <span class="pl-s"><span class="pl-pds">"</span>stable<span class="pl-pds">"</span></span>
|
||||
- <span class="pl-ent">run</span>: <span class="pl-s">go test -race -failfast ./...</span>
|
||||
<span class="pl-ent">build</span>:
|
||||
<span class="pl-ent">name</span>: <span class="pl-s">Build</span>
|
||||
<span class="pl-ent">runs-on</span>: <span class="pl-s">${{ matrix.os }}</span>
|
||||
<span class="pl-ent">strategy</span>:
|
||||
<span class="pl-ent">matrix</span>:
|
||||
<span class="pl-ent">os</span>: <span class="pl-s">[ubuntu-latest, macos-latest, windows-latest]</span>
|
||||
<span class="pl-ent">steps</span>:
|
||||
- <span class="pl-ent">uses</span>: <span class="pl-s">actions/checkout@v3</span>
|
||||
- <span class="pl-ent">uses</span>: <span class="pl-s">actions/setup-go@v4</span>
|
||||
<span class="pl-ent">with</span>:
|
||||
<span class="pl-ent">go-version</span>: <span class="pl-s"><span class="pl-pds">"</span>stable<span class="pl-pds">"</span></span>
|
||||
- <span class="pl-ent">run</span>: <span class="pl-s">go build .</span>
|
||||
<span class="pl-ent">golangci-lint</span>:
|
||||
<span class="pl-ent">name</span>: <span class="pl-s">golangci-lint</span>
|
||||
<span class="pl-ent">runs-on</span>: <span class="pl-s">ubuntu-latest</span>
|
||||
<span class="pl-ent">steps</span>:
|
||||
- <span class="pl-ent">uses</span>: <span class="pl-s">actions/checkout@v3</span>
|
||||
<span class="pl-ent">with</span>:
|
||||
<span class="pl-ent">fetch-depth</span>: <span class="pl-c1">0</span>
|
||||
- <span class="pl-ent">uses</span>: <span class="pl-s">actions/setup-go@v4</span>
|
||||
<span class="pl-ent">with</span>:
|
||||
<span class="pl-ent">go-version</span>: <span class="pl-s"><span class="pl-pds">"</span>stable<span class="pl-pds">"</span></span>
|
||||
- <span class="pl-ent">uses</span>: <span class="pl-s">golangci/golangci-lint-action@v3</span>
|
||||
<span class="pl-ent">with</span>:
|
||||
<span class="pl-ent">version</span>: <span class="pl-s">latest</span></pre>
|
||||
</div>
|
||||
<div class="markdown-heading">
|
||||
<h2 class="heading-element">Go</h2>
|
||||
<a
|
||||
id="user-content-go"
|
||||
class="anchor"
|
||||
aria-label="Permalink: Go"
|
||||
href="#go"
|
||||
><span aria-hidden="true" class="octicon octicon-link"></span
|
||||
></a>
|
||||
</div>
|
||||
<p><code>.golangci.yml</code>:</p>
|
||||
<div class="highlight highlight-source-yaml">
|
||||
<pre><span class="pl-ent">run</span>:
|
||||
<span class="pl-ent">timeout</span>: <span class="pl-c1">5m</span>
|
||||
<span class="pl-ent">tests</span>: <span class="pl-c1">false</span>
|
||||
|
||||
<span class="pl-ent">output</span>:
|
||||
<span class="pl-ent">sort-results</span>: <span class="pl-c1">true</span>
|
||||
|
||||
<span class="pl-ent">linters</span>:
|
||||
<span class="pl-ent">disable-all</span>: <span class="pl-c1">true</span>
|
||||
<span class="pl-ent">enable</span>:
|
||||
<span class="pl-c"><span class="pl-c">#</span> Default</span>
|
||||
- <span class="pl-s">errcheck</span>
|
||||
- <span class="pl-s">gosimple</span>
|
||||
- <span class="pl-s">govet</span>
|
||||
- <span class="pl-s">ineffassign</span>
|
||||
- <span class="pl-s">staticcheck</span>
|
||||
- <span class="pl-s">typecheck</span>
|
||||
- <span class="pl-s">unused</span>
|
||||
<span class="pl-c"><span class="pl-c">#</span> Custom</span>
|
||||
- <span class="pl-s">bodyclose</span>
|
||||
- <span class="pl-s">err113</span>
|
||||
- <span class="pl-s">errchkjson</span>
|
||||
- <span class="pl-s">errname</span>
|
||||
- <span class="pl-s">errorlint</span>
|
||||
- <span class="pl-s">fatcontext</span>
|
||||
- <span class="pl-s">forcetypeassert</span>
|
||||
- <span class="pl-s">gocritic</span>
|
||||
- <span class="pl-s">gofumpt</span>
|
||||
- <span class="pl-s">gosec</span>
|
||||
- <span class="pl-s">importas</span>
|
||||
- <span class="pl-s">makezero</span>
|
||||
- <span class="pl-s">nilnil</span>
|
||||
- <span class="pl-s">noctx</span>
|
||||
- <span class="pl-s">prealloc</span>
|
||||
- <span class="pl-s">reassign</span>
|
||||
- <span class="pl-s">sqlclosecheck</span>
|
||||
- <span class="pl-s">unconvert</span>
|
||||
<span class="pl-ent">fast</span>: <span class="pl-c1">true</span>
|
||||
|
||||
<span class="pl-ent">linters-settings</span>:
|
||||
<span class="pl-c"><span class="pl-c">#</span> Default</span>
|
||||
<span class="pl-ent">govet</span>:
|
||||
<span class="pl-ent">check-shadowing</span>: <span class="pl-c1">false</span>
|
||||
<span class="pl-ent">disable-all</span>: <span class="pl-c1">true</span>
|
||||
<span class="pl-ent">enable</span>:
|
||||
- <span class="pl-s">assign</span>
|
||||
- <span class="pl-s">atomic</span>
|
||||
- <span class="pl-s">bools</span>
|
||||
- <span class="pl-s">buildtag</span>
|
||||
- <span class="pl-s">composites</span>
|
||||
- <span class="pl-s">copylocks</span>
|
||||
- <span class="pl-s">fieldalignment</span>
|
||||
- <span class="pl-s">httpresponse</span>
|
||||
- <span class="pl-s">loopclosure</span>
|
||||
- <span class="pl-s">lostcancel</span>
|
||||
- <span class="pl-s">nilfunc</span>
|
||||
- <span class="pl-s">printf</span>
|
||||
- <span class="pl-s">unmarshal</span>
|
||||
- <span class="pl-s">unreachable</span>
|
||||
- <span class="pl-s">unusedresult</span>
|
||||
<span class="pl-ent">staticcheck</span>:
|
||||
<span class="pl-ent">checks</span>: <span class="pl-s">["all", "-SA1019"]</span>
|
||||
<span class="pl-c"><span class="pl-c">#</span> Custom</span>
|
||||
<span class="pl-ent">gocritic</span>:
|
||||
<span class="pl-ent">disabled-checks</span>:
|
||||
- <span class="pl-s">ifElseChain</span>
|
||||
- <span class="pl-s">singleCaseSwitch</span>
|
||||
- <span class="pl-s">unnamedResult</span>
|
||||
- <span class="pl-s">whyNoLint</span>
|
||||
<span class="pl-ent">enabled-tags</span>:
|
||||
- <span class="pl-s">diagnostic</span>
|
||||
- <span class="pl-s">style</span>
|
||||
<span class="pl-ent">gosec</span>:
|
||||
<span class="pl-ent">excludes</span>:
|
||||
- <span class="pl-c1">G101</span>
|
||||
- <span class="pl-c1">G112</span>
|
||||
- <span class="pl-c1">G115</span>
|
||||
- <span class="pl-c1">G204</span>
|
||||
- <span class="pl-c1">G402</span>
|
||||
- <span class="pl-c1">G404</span>
|
||||
- <span class="pl-c1">G501</span>
|
||||
- <span class="pl-c1">G505</span>
|
||||
<span class="pl-ent">exclude-generated</span>: <span class="pl-c1">true</span>
|
||||
<span class="pl-ent">reassign</span>:
|
||||
<span class="pl-ent">patterns</span>:
|
||||
- <span class="pl-s"><span class="pl-pds">"</span>.*<span class="pl-pds">"</span></span>
|
||||
|
||||
<span class="pl-ent">issues</span>:
|
||||
<span class="pl-ent">exclude-dirs</span>:
|
||||
- <span class="pl-s"><span class="pl-pds">"</span>.*test.*<span class="pl-pds">"</span></span>
|
||||
- <span class="pl-s"><span class="pl-pds">"</span>.*mock.*<span class="pl-pds">"</span></span>
|
||||
- <span class="pl-s"><span class="pl-pds">"</span>.*example.*<span class="pl-pds">"</span></span>
|
||||
- <span class="pl-s"><span class="pl-pds">"</span>.*utils.*<span class="pl-pds">"</span></span>
|
||||
<span class="pl-ent">exclude-files</span>:
|
||||
- <span class="pl-s"><span class="pl-pds">"</span>.*Mock.*<span class="pl-pds">"</span></span>
|
||||
- <span class="pl-s"><span class="pl-pds">"</span>.*_mock.*<span class="pl-pds">"</span></span></pre>
|
||||
</div>
|
||||
<div class="markdown-heading">
|
||||
<h2 class="heading-element">ssh config</h2>
|
||||
<a
|
||||
|
|
|
@ -156,211 +156,6 @@ Thanks:
|
|||
- [Phishing with Unicode Domains](https://www.xudongz.com/blog/2017/idn-phishing/)
|
||||
- https://sizeof.cat/links/
|
||||
|
||||
## `.gitignore`
|
||||
|
||||
```txt
|
||||
# macOS
|
||||
.DS_Store
|
||||
|
||||
# Window
|
||||
*.exe
|
||||
|
||||
# IntelliJ
|
||||
.idea
|
||||
|
||||
# VSCode
|
||||
.vscode
|
||||
|
||||
# Go
|
||||
coverage.out
|
||||
vendor
|
||||
|
||||
# GoReleaser
|
||||
dist
|
||||
```
|
||||
|
||||
## GitHub Actions
|
||||
|
||||
`dependabot.yml`:
|
||||
|
||||
```yaml
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "gomod"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
```
|
||||
|
||||
`go.yml`:
|
||||
|
||||
```yaml
|
||||
name: Go
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- "**.go"
|
||||
- "go.mod"
|
||||
- "go.sum"
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- "**.go"
|
||||
- "go.mod"
|
||||
- "go.sum"
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: "stable"
|
||||
- run: go test -race -failfast ./...
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: "stable"
|
||||
- run: go build .
|
||||
golangci-lint:
|
||||
name: golangci-lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: "stable"
|
||||
- uses: golangci/golangci-lint-action@v3
|
||||
with:
|
||||
version: latest
|
||||
```
|
||||
|
||||
## Go
|
||||
|
||||
`.golangci.yml`:
|
||||
|
||||
```yaml
|
||||
run:
|
||||
timeout: 5m
|
||||
tests: false
|
||||
|
||||
output:
|
||||
sort-results: true
|
||||
|
||||
linters:
|
||||
disable-all: true
|
||||
enable:
|
||||
# Default
|
||||
- errcheck
|
||||
- gosimple
|
||||
- govet
|
||||
- ineffassign
|
||||
- staticcheck
|
||||
- typecheck
|
||||
- unused
|
||||
# Custom
|
||||
- bodyclose
|
||||
- err113
|
||||
- errchkjson
|
||||
- errname
|
||||
- errorlint
|
||||
- fatcontext
|
||||
- forcetypeassert
|
||||
- gocritic
|
||||
- gofumpt
|
||||
- gosec
|
||||
- importas
|
||||
- makezero
|
||||
- nilnil
|
||||
- noctx
|
||||
- prealloc
|
||||
- reassign
|
||||
- sqlclosecheck
|
||||
- unconvert
|
||||
fast: true
|
||||
|
||||
linters-settings:
|
||||
# Default
|
||||
govet:
|
||||
check-shadowing: false
|
||||
disable-all: true
|
||||
enable:
|
||||
- assign
|
||||
- atomic
|
||||
- bools
|
||||
- buildtag
|
||||
- composites
|
||||
- copylocks
|
||||
- fieldalignment
|
||||
- httpresponse
|
||||
- loopclosure
|
||||
- lostcancel
|
||||
- nilfunc
|
||||
- printf
|
||||
- unmarshal
|
||||
- unreachable
|
||||
- unusedresult
|
||||
staticcheck:
|
||||
checks: ["all", "-SA1019"]
|
||||
# Custom
|
||||
gocritic:
|
||||
disabled-checks:
|
||||
- ifElseChain
|
||||
- singleCaseSwitch
|
||||
- unnamedResult
|
||||
- whyNoLint
|
||||
enabled-tags:
|
||||
- diagnostic
|
||||
- style
|
||||
gosec:
|
||||
excludes:
|
||||
- G101
|
||||
- G112
|
||||
- G115
|
||||
- G204
|
||||
- G402
|
||||
- G404
|
||||
- G501
|
||||
- G505
|
||||
exclude-generated: true
|
||||
reassign:
|
||||
patterns:
|
||||
- ".*"
|
||||
|
||||
issues:
|
||||
exclude-dirs:
|
||||
- ".*test.*"
|
||||
- ".*mock.*"
|
||||
- ".*example.*"
|
||||
- ".*utils.*"
|
||||
exclude-files:
|
||||
- ".*Mock.*"
|
||||
- ".*_mock.*"
|
||||
```
|
||||
|
||||
## ssh config
|
||||
|
||||
Edit `~/.ssh/config`
|
||||
|
|
Loading…
Reference in New Issue