Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
Setup project boilerplate.
  • Loading branch information
faabiosr committed Jul 14, 2023
0 parents commit 04bc579
Show file tree
Hide file tree
Showing 8 changed files with 162 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: test

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
test:
name: test
runs-on: [ubuntu-latest]

steps:
- name: checkout the code
uses: actions/checkout@v3

- name: setup go
uses: actions/setup-go@v3
with:
go-version: '1.20.x'

- name: unshallow
run: git fetch --prune --unshallow

- name: golanci-linter
uses: golangci/golangci-lint-action@v3
with:
version: v1.53.3

- name: run unit tests
run: make test

- name: upload code coverage
uses: codecov/codecov-action@v3.1.1
if: contains(github.ref, 'main')
with:
file: ./cover.out
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cover*
36 changes: 36 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
run:
timeout: "120s"

output:
format: "colored-line-number"

linters:
enable:
- gocyclo
- unconvert
- goimports
- unused
- vetshadow
- misspell
- nakedret
- errcheck
- revive
- ineffassign
- goconst
- vet
- unparam
- gofumpt
- prealloc
- gomnd
- gocritic


linters-settings:
revive:
rules:
- name: package-comments
disabled: true

issues:
exclude-use-default: false
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2023 Fábio da Silva Ribeiro

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
27 changes: 27 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.DEFAULT_GOAL := help

clean: ## clean up files generated by coverage or go mod
@rm -fR ./vendor/ ./cover.*
.PHONY: clean

cover: test ## run unit tests and generates the html coverage file
@go tool cover -html=./cover.text -o ./cover.html
@test -f ./cover.text && rm ./cover.text;
.PHONY: cover

help: ## display help screen
@sed \
-e '/^[a-zA-Z0-9_\-]*:.*##/!d' \
-e 's/:.*##\s*/:/' \
-e 's/^\(.\+\):\(.*\)/$(shell tput setaf 6)\1$(shell tput sgr0):\2/' \
$(MAKEFILE_LIST) | column -c2 -t -s :
@echo ''
.PHONY: help

lint: ## golangci linters
@golangci-lint run ./...
.PHONY: lint

test: ## run unit tests
@go test -v -race -coverprofile=./cover.text -covermode=atomic $(shell go list ./...)
.PHONY: test
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Golang Movies API - Demo

[![Codecov branch](https://img.shields.io/codecov/c/github/faabiosr/go-movies-demo/master.svg?style=flat-square)](https://codecov.io/gh/faabiosr/go-movies-demo)
[![Go Report Card](https://goreportcard.com/badge/github.com/faabiosr/go-movies-demo?style=flat-square)](https://goreportcard.com/report/github.com/faabiosr/go-movies-demo)
[![License](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square)](https://github.com/faabiosr/go-movies-demo/blob/master/LICENSE)

Movies API

## Development

### Requirements

The entire environment is based in Golang, and you need install the tools below:
- Install [Go](https://golang.org)
- Install [GolangCI-Lint](https://github.com/golangci/golangci-lint#install) - Linter

### Makefile

Please run the make target below to see the provided targets.

```sh
$ make help
```

## License

This project is released under the MIT licence. See [LICENSE](https://github.com/faabiosr/go-movies-demo/blob/master/LICENSE) for more details.
7 changes: 7 additions & 0 deletions cmd/movies/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main

import "fmt"

func main() {
fmt.Println("It's work!")
}
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/faabiosr/go-movies-demo

go 1.20

0 comments on commit 04bc579

Please sign in to comment.