Skip to content

Commit

Permalink
add go modules, some cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonhancock committed Oct 18, 2023
1 parent 4b8b9aa commit 4438cf5
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 24 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/pullrequests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Tests
on: [pull_request]

jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 'stable'

- name: Go Tests
run: go test -v ./...
28 changes: 28 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: release
on:
push:
branches:
- main

jobs:
release:
name: Build and Release
runs-on: [ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Release Version
id: version
run: |
export RELEASE_VERSION=v0.0.${{ github.run_number }}
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
echo "release_version=$RELEASE_VERSION" >> $GITHUB_OUTPUT
- name: create tag
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git tag -a $RELEASE_VERSION -m $RELEASE_VERSION
git push origin $RELEASE_VERSION
15 changes: 0 additions & 15 deletions .travis.yml

This file was deleted.

11 changes: 11 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module github.com/jasonhancock/multiplex

go 1.21.3

require github.com/stretchr/testify v1.8.4

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
10 changes: 10 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
14 changes: 5 additions & 9 deletions plexer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ import (
"testing"
"time"

"github.com/cheekybits/is"
"github.com/stretchr/testify/require"
)

func TestPlexer(t *testing.T) {
is := is.New(t)

var chans []chan []byte
for i := 0; i < 10; i++ {
chans = append(chans, make(chan []byte, 1000))
Expand Down Expand Up @@ -50,14 +48,12 @@ func TestPlexer(t *testing.T) {
mod++
}
val, err := strconv.Atoi(string(values[i]))
is.NoErr(err)
is.True(val%10 == mod)
require.NoError(t, err)
require.True(t, val%10 == mod)
}
}

func TestPlexerCloseChan(t *testing.T) {
is := is.New(t)

var chans []chan []byte

for i := 0; i < 10; i++ {
Expand Down Expand Up @@ -94,8 +90,8 @@ func TestPlexerCloseChan(t *testing.T) {
}
wg.Wait()

is.Equal(values[0], []byte("foo"))
is.Equal(values[1], []byte("bar"))
require.Equal(t, []byte("foo"), values[0])
require.Equal(t, []byte("bar"), values[1])
}

func chConv(channels ...chan []byte) []<-chan []byte {
Expand Down

0 comments on commit 4438cf5

Please sign in to comment.