Skip to content

Commit

Permalink
Merge branch 'master' into moul-patch-2
Browse files Browse the repository at this point in the history
  • Loading branch information
moul authored Feb 14, 2020
2 parents e66cc86 + 237d125 commit 1ccce84
Show file tree
Hide file tree
Showing 32 changed files with 595 additions and 113 deletions.
64 changes: 10 additions & 54 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,61 +1,17 @@
version: 2.1

executors:
golang:
working_directory: /go/src/moul.io/golang-repo-template
docker:
- image: circleci/golang:1.12
environment:
GO111MODULE: "on"
DOCKER_IMAGE: moul/golang-repo-template

docker:
docker:
- image: docker:18.06.3-ce-git

orbs:
codecov: codecov/codecov@1.0.5
moul: moul/build@1.5.0
retry: moul/retry@0.6.0
docker: circleci/docker@0.5.13
#dl: moul/dl@1.7.0
tools: gotest/tools@0.0.9

jobs:
go-build:
executor: golang
steps:
- checkout
- restore_cache:
keys:
- go-mod-v1-{{ checksum "go.sum" }}
- go-mod-v1-
- retry/install
- tools/mod-download
- tools/mod-tidy-check
- run: retry -m 3 make install
- run: retry -m 3 make test
- moul/install_golangci-lint
- run: PATH=$PATH:$(pwd)/bin retry -m 3 make lint
- codecov/upload:
file: coverage.txt
- save_cache:
key: go-mod-v1-{{ checksum "go.sum" }}
paths:
- /go/pkg/mod

docker-build:
executor: docker
steps:
- checkout
- setup_remote_docker:
docker_layer_caching: true
- docker/build:
image: moul/golang-repo-template
#- docker/dockerlint
moul: moul/build@1.12.1 # https://github.com/moul/build

workflows:
main:
jobs:
- go-build
- docker-build
- moul/golang-build:
gopkg: moul.io/golang-repo-template
- moul/golang-build:
gopkg: moul.io/golang-repo-template
tag: '1.12'
- moul/golang-build:
gopkg: moul.io/golang-repo-template
tag: '1.11'
- moul/docker-build
23 changes: 19 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,27 @@ trim_trailing_whitespace = true
indent_style = space
indent_size = 4

[Makefile]
[*.mod]
indent_style = tab

[{Makefile,**.mk}]
indent_style = tab

[*.go]
indent_style = tab

[*.css]
indent_size = 2

[*.proto]
indent_size = 2

[*.ftl]
indent_size = 2

[*.toml]
indent_size = 2

[*.swift]
indent_size = 4

Expand All @@ -30,16 +42,19 @@ indent_size = 2
block_comment_start = /*
block_comment_end = */

[*.html]
[*.{html,htm}]
indent_size = 2

[*.bat]
end_of_line = crlf

[*.{json,yml}]
[*.{yml,yaml}]
indent_size = 2

[*.json]
indent_size = 2

[.{babelrc,eslintrc}]
[.{babelrc,eslintrc,prettierrc}]
indent_size = 2

[{Fastfile,.buckconfig,BUCK}]
Expand Down
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@

# Collapse vendored and generated files on GitHub
vendor/* linguist-vendored
rules.mk linguist-vendored
*/vendor/* linguist-vendored
*.gen.* linguist-generated
*.pb.go linguist-generated
go.sum linguist-generated
go.mod linguist-generated
gen.sum linguist-generated

# Reduce conflicts on markdown files
*.md merge=union
3 changes: 3 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

run-parts ./githooks/pre-commit.d/ -v --exit-on-error
3 changes: 3 additions & 0 deletions .githooks/pre-commit.d/generate
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

make generate
53 changes: 53 additions & 0 deletions .githooks/pre-commit.d/lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/bash

STAGED_GO_FILES=$(git diff --cached --name-only | grep "\.go$")

if [[ "$STAGED_GO_FILES" = "" ]]; then
exit 0
fi

GOLINT=$GOPATH/bin/golint
GOIMPORTS=$GOPATH/bin/goimports
PASS=true

# Check for golint
if [[ ! -x "$GOLINT" ]]; then
printf "\t\033[41mPlease install golint\033[0m (go get -u golang.org/x/lint/golint)\n"
PASS=false
fi

# Check for goimports
if [[ ! -x "$GOIMPORTS" ]]; then
printf "\t\033[41mPlease install goimports\033[0m (go get golang.org/x/tools/cmd/goimports)\n"
PASS=false
fi

if ! $PASS; then
exit 1
fi

PASS=true

for FILE in $STAGED_GO_FILES
do
# Run goimports on the staged file
$GOIMPORTS -w $FILE

# Run golint on the staged file and check the exit status
$GOLINT "-set_exit_status" $FILE
if [[ $? == 1 ]]; then
printf "\t\033[31mgolint $FILE\033[0m \033[0;30m\033[41mFAILURE!\033[0m\n"
PASS=false
else
printf "\t\033[32mgolint $FILE\033[0m \033[0;30m\033[42mpass\033[0m\n"
fi
done

if ! $PASS; then
printf "\033[0;30m\033[41mCOMMIT FAILED\033[0m\n"
exit 1
else
printf "\033[0;30m\033[42mCOMMIT SUCCEEDED\033[0m\n"
fi

exit 0
6 changes: 3 additions & 3 deletions CODE_OF_CONDUCT.md → .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ include:
Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
professional setting

## Our Responsibilities

Expand Down
File renamed without changes.
4 changes: 3 additions & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
github: ["moul"]
patreon: moul
open_collective: moul
custom: ["https://manfred.life/about"]
custom:
- "https://www.buymeacoffee.com/moul"
- "https://manfred.life/donate"
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: Bug report
about: Create a report to help us improve
title: "[BUG] "
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Type '....'
3. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots / Logs**
If applicable, add screenshots or logs to help explain your problem.

**Versions (please complete the following information, if relevant):**
- Software version: [e.g. v1.2.3, latest, building from sources]
- OS: [e.g. Ubuntu, Mac, iOS, ...]
- Golang version [e.g. 1.13]

**Additional context**
Add any other context about the problem here.
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/custom.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
name: Custom
about: 'Anything else: questions, discussions, thanks, ascii-arts, ...'
title: ''
labels: discussion
assignees: moul

---
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: "[IDEA] "
labels: enhancement
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
9 changes: 9 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!--
Thank you for your contribution to this repo!
Before submitting a pull request, please check the following:
- reference any related issue, PR, link
- use the "WIP" title prefix if you need help or more time to finish your PR
you can remove this markdown comment
-->
File renamed without changes.
13 changes: 13 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Semantic Release

on: push

jobs:
semantic-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: codfish/semantic-release-action@v1
if: github.ref == 'refs/heads/master'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
coverage.txt

# Vendors
package-lock.json
node_modules/
vendor/

Expand Down
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ linters:
- errcheck
- unused
- varcheck
- gochecknoinits
- staticcheck
- unconvert
- gofmt
Expand Down
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ brew:
name: homebrew-moul
commit_author:
name: moul-bot
email: "m+bot@42.am"
email: "bot@moul.io"
homepage: https://manfred.life/
description: "golang-repo-template"
8 changes: 8 additions & 0 deletions .releaserc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
branch: 'master',
plugins: [
'@semantic-release/commit-analyzer',
'@semantic-release/release-notes-generator',
'@semantic-release/github',
],
};
4 changes: 4 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# This file lists all individuals having contributed content to the repository.
# For how it is generated, see 'https://github.com/moul/rules.mk'

Manfred Touron <m@42.am>
22 changes: 22 additions & 0 deletions COPYRIGHT
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Copyright 2019 Manfred Touron and other golang-repo-template Developers.

Intellectual Property Notice
----------------------------

golang-repo-template is licensed under the Apache License, Version 2.0
(see LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0) or
the MIT license (see LICENSE-MIT or http://opensource.org/licenses/MIT),
at your option.

Copyrights and patents in the golang-repo-templates project are retained
by contributors.
No copyright assignment is required to contribute to golang-repo-template.

SPDX-License-Identifier: (Apache-2.0 OR MIT)

SPDX usage
----------

Individual files may contain SPDX tags instead of the full license text.
This enables machine processing of license information based on the SPDX
License Identifiers that are available here: https://spdx.org/licenses/
Loading

0 comments on commit 1ccce84

Please sign in to comment.