Skip to content

Commit

Permalink
Add go.mod and GH actions
Browse files Browse the repository at this point in the history
  • Loading branch information
bancek committed May 20, 2024
1 parent 953dc42 commit eb033bc
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 4 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
on:
push:
tags:
- v*
branches:
- master
pull_request:
name: Test
jobs:
test:
strategy:
matrix:
go-version: [1.21.x, 1.22.x]
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Get dependencies
run: go get ./...
- name: Test
run: |
go test ./...
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015 Koofr
Copyright (c) 2024 Koofr

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,12 @@ SafeOnce Go package

## Install

go get github.com/koofr/safeonce
```sh
go get github.com/koofr/safeonce
```

## Test

```sh
go test
```
3 changes: 2 additions & 1 deletion example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package safeonce_test

import (
"fmt"

"github.com/koofr/safeonce"
)

func ExampleOnce() {
func ExampleSafeOnce() {
var safeOnce safeonce.SafeOnce

err := safeOnce.Do(func() error {
Expand Down
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/koofr/safeonce

go 1.21
3 changes: 2 additions & 1 deletion safeonce_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package safeonce_test

import (
"fmt"
. "github.com/koofr/safeonce"
"testing"

. "github.com/koofr/safeonce"
)

type one int
Expand Down

0 comments on commit eb033bc

Please sign in to comment.