Skip to content

Featuuuuure #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 14 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build and push

on:
push:
branches:
- main

jobs:
build:
permissions:
packages: write
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
push: true
tags: ghcr.io/${{ github.repository }}:latest
37 changes: 37 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# The "display name", shown in the GitHub UI
name: Build and test

# Trigger, run on push on any branch
on:
pull_request:

jobs:
test: # The 'build' job
name: "Build application"
runs-on: 'ubuntu-latest'
steps:
# Checkout code
- uses: actions/checkout@v4

# Install go 1.21
- name: Setup go
uses: actions/setup-go@v4
with: # Specify input variables to the action
go-version: '1.21.x'

# Shell script to print the version
- run: go version

- name: Build
run: go build -v ./...

- name: Test
run: go test ./...
lint:
name: "Lint code"
runs-on: 'ubuntu-latest'
steps:
- name: Verify formatting
run: |
no_unformatted_files="$(gofmt -l $(git ls-files '*.go') | wc -l)"
exit "$no_unformatted_files"
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/greeting/greet.go
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ import (
"errors"
"fmt"
)

// Nice feature comment
func Greet(names []string) (string, error) {
if len(names) == 0 {
return "", errors.New("at least one name must be specified")