Skip to content

Commit

Permalink
chore: initialise Go project (#6)
Browse files Browse the repository at this point in the history
* chore: add editorconfig

* chore: initialise go project

* chore: scaffold workflow

* chore: add lint, format and test jobs

* test: force bad formatting

* fix: check changed files

* fix: reformat
  • Loading branch information
p5 authored Jul 19, 2024
1 parent 5181262 commit 924f375
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
insert_final_newline = true
charset = utf-8
end_of_line = lf
trim_trailing_whitespace = true
max_line_length = 80

[*.go]
indent_style = space
indent_size = 2
66 changes: 66 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: CI

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

permissions:
contents: read
pull-requests: read
checks: write

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: ./go.mod

- name: Go Vet
run: go vet ./...

- name: Go Lint
uses: golangci/golangci-lint-action@v6
with:
version: latest

format:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: ./go.mod

- name: Go Fmt
run: go fmt ./...

- name: Check changed files
run: |
git diff --exit-code
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: ./go.mod

- name: Go Test
run: go test -v ./...
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/rsturla/dmarc-monitor

go 1.22.5
7 changes: 7 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main

import "fmt"

func main() {
fmt.Println("Hello, World!")
}

0 comments on commit 924f375

Please sign in to comment.