Skip to content

Commit

Permalink
chore: customize project to use new name
Browse files Browse the repository at this point in the history
  • Loading branch information
Nr18 committed Aug 30, 2023
1 parent 420761d commit c14ef0c
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 74 deletions.
9 changes: 4 additions & 5 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
project_name: "golang-template"
project_name: "aws-iam-user"

# before are hooks that will be run before any builds are done, so good to put install scripts and stuff that your builds need here
before:
Expand All @@ -13,15 +13,15 @@ signs:

builds:
- main: ./main.go
binary: golang-template
binary: aws-iam-user
goos: ["linux", "darwin", "windows"]
goarch: ["386", "amd64", "arm64"]
env:
- CGO_ENABLED=0

nfpms:
- package_name: golang-template
homepage: https://github.com/conijnio/golang-template/
- package_name: aws-iam-user
homepage: https://github.com/conijnio/aws-iam-user/
maintainer: Joris Conijn <joris@conijnonline.nl>
description: |-
Template for golang projects
Expand All @@ -36,4 +36,3 @@ changelog:
sort: "asc"
filters:
exclude: ["^docs:", "demo", "^hugo:", "Merge pull request", "Merge branch"]

63 changes: 7 additions & 56 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,16 @@
# Golang Template

![Go Version](https://img.shields.io/github/go-mod/go-version/conijnio/golang-template)
![Go Version](https://img.shields.io/github/go-mod/go-version/conijnio/aws-iam-user)
[![License](https://img.shields.io/badge/License-Apache2-green.svg)](./LICENSE)
[![Maintenance](https://img.shields.io/badge/Maintained-yes-green.svg)](https://github.com/conijnio/golang-template/graphs/commit-activity)
[![Workflow: ci](https://github.com/conijnio/golang-template/actions/workflows/ci.yml/badge.svg)](https://github.com/conijnio/golang-template/actions/workflows/go.yml)
[![Workflow: release](https://github.com/conijnio/golang-template/actions/workflows/release.yml/badge.svg)](https://github.com/conijnio/golang-template/actions/workflows/goreleaser.yml)
![Release](https://img.shields.io/github/v/release/conijnio/golang-template)
[![Go Report Card](https://goreportcard.com/badge/github.com/conijnio/golang-template)](https://goreportcard.com/report/github.com/conijnio/golang-template)
[![Coverage Status](https://coveralls.io/repos/github/conijnio/golang-template/badge.svg?branch=main)](https://coveralls.io/github/conijnio/golang-template?branch=main)
[![Maintenance](https://img.shields.io/badge/Maintained-yes-green.svg)](https://github.com/conijnio/aws-iam-user/graphs/commit-activity)
[![Workflow: ci](https://github.com/conijnio/aws-iam-user/actions/workflows/ci.yml/badge.svg)](https://github.com/conijnio/aws-iam-user/actions/workflows/go.yml)
[![Workflow: release](https://github.com/conijnio/aws-iam-user/actions/workflows/release.yml/badge.svg)](https://github.com/conijnio/aws-iam-user/actions/workflows/goreleaser.yml)
![Release](https://img.shields.io/github/v/release/conijnio/aws-iam-user)
[![Go Report Card](https://goreportcard.com/badge/github.com/conijnio/aws-iam-user)](https://goreportcard.com/report/github.com/conijnio/aws-iam-user)
[![Coverage Status](https://coveralls.io/repos/github/conijnio/aws-iam-user/badge.svg?branch=main)](https://coveralls.io/github/conijnio/aws-iam-user?branch=main)

Template repository for Golang projects.

## First steps!

Since you are starting from a template there are some steps that you need to take!

### Replace golang-template with your repository name

We need to replace all the `golang-template` occurrences with the new project name:

```shell
find . \( -iname '*.yaml' -o -iname '*.yml' -o -iname '*.md' -o -iname '*.go' -o -iname '*.mod' -o -iname '*.toml' \) -exec sed -i '' -e "s/golang-template/golang-project/g" {} \;
```

### Setup documentation pages

Because we use the hugo theme as a submodule we need to initialize it:

```shell
git submodule init
git submodule update
```

In GitHub go to the project **Settings**, **Pages** and select `GitHub Actions` as the **Source** under **Build and Deploy**.

Now you only need to write the documentation ;-)

### Create first release

Time to create an initial release!

```shell
git tag latest
git tag v0.1.0
git push --tags
```

## Prerequisites

You will need to install the following tools to successfully run the make targets:
Expand All @@ -72,20 +37,6 @@ pre-commit install
- `make lint`, performs linting actions on the codebase.
- `make test`, runs all the unit tests.

### Run goreleaser locally

Because we enabled signing you need to supply a `GPG_FINGERPRINT` environment variable. You will be prompted for a passphrase.

```shell
GPG_FINGERPRINT=C490C64E6938FD0C goreleaser release --snapshot --clean
```

Afterward, you can validate the signature using the following command:

```shell
gpg --verify [Signature] [File]
```

## License

This project is free and open source software licensed under the [Apache 2.0 License](./LICENSE).
8 changes: 4 additions & 4 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package cmd

import (
"fmt"
"github.com/conijnio/golang-template/pkg/core"
"github.com/conijnio/aws-iam-user/pkg/core"
"github.com/spf13/cobra"
"os"
)
Expand All @@ -13,10 +13,10 @@ var (
)

var rootCmd = &cobra.Command{
Use: "golang-template",
Short: "golang-template - Sample cli tool implementation",
Use: "aws-iam-user",
Short: "aws-iam-user - Sample cli tool implementation",
PreRun: preRun,
Example: "golang-template",
Example: "aws-iam-user",
RunE: func(cmd *cobra.Command, args []string) error {
return core.MainRoutine()
},
Expand Down
4 changes: 2 additions & 2 deletions cmd/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ func TestRootCmdVersion(t *testing.T) {
t.Errorf("No error was expected but received: %s", err)
}

if output != "golang-template version 0.1.0" {
t.Errorf("Expected 'golang-template version 0.1.0' but received %s", output)
if output != "aws-iam-user version 0.1.0" {
t.Errorf("Expected 'aws-iam-user version 0.1.0' but received %s", output)
}
}

Expand Down
2 changes: 1 addition & 1 deletion docs/config/_default/config.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
languageCode = "en-us"
title = "Golang Template"
title = "AWS IAM User"
theme = "hugo-theme-learn"
baseURL = "http://localhost:1313"

Expand Down
4 changes: 2 additions & 2 deletions docs/config/production/config.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
baseURL = "https://conijnio.github.io/golang-template/"
landingPageUrl = "https://conijnio.github.io/golang-template/"
baseURL = "https://conijnio.github.io/aws-iam-user/"
landingPageUrl = "https://conijnio.github.io/aws-iam-user/"
2 changes: 1 addition & 1 deletion docs/content/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
chapter: true
---

# Golang Template
# AWS IAM User

{{< figure src="/images/golang.png?width=40pc" >}}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/conijnio/golang-template
module github.com/conijnio/aws-iam-user

go 1.20

Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package main

import "github.com/conijnio/golang-template/cmd"
import "github.com/conijnio/aws-iam-user/cmd"

var (
version = "dev"
Expand Down
2 changes: 1 addition & 1 deletion pkg/core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

func MainRoutine() error {
log.Debug("Main routine is called")
fmt.Println("Hello from golang-template main-routine")
fmt.Println("Hello from aws-iam-user main-routine")
log.Debug("Main routine is complete")

return nil
Expand Down

0 comments on commit c14ef0c

Please sign in to comment.