Commit 37e26dd8 authored by Trevor Slocum's avatar Trevor Slocum

Update CI script

parent c5a38c0f
Pipeline #112181515 passed with stages
in 2 minutes and 13 seconds
image: golang:latest
stages:
- test
- validate
- build
fmt:
stage: validate
script:
- gofmt -l -s -e .
- exit $(gofmt -l -s -e . | wc -l)
lint:
stage: validate
script:
- go get -u golang.org/x/lint/golint
- golint -set_exit_status
vet:
stage: validate
script:
- apt-get update && apt-get install -y libasound2-dev
- go vet -composites=false ./...
test:
image: golang:latest
stage: test
stage: validate
script:
- apt-get update && apt-get install -y libasound2-dev
- go test -race -v ./...
build:
stage: build
script:
- apt-get update && apt-get install -y libasound2-dev
- go test -v ./...
- go build -race
......@@ -151,7 +151,7 @@ func play(audioFile *audioFile) {
streamFd = os.NewFile(uintptr(streamFdInt), "out")
go func() {
rateLimitedStreamer := NewRateLimitedStreamer(ctrl, bufferSize/64)
rateLimitedStreamer := newRateLimitedStreamer(ctrl, bufferSize/64)
for {
_ = wav.Encode(streamFd, rateLimitedStreamer, playingFormat)
time.Sleep(250 * time.Millisecond)
......
......@@ -110,9 +110,9 @@ func listToggleHidden() {
showHiddenFolders = !showHiddenFolders
if showHiddenFolders {
statusText = "Hidden folders: show"
statusText = "Hidden folders: shown"
} else {
statusText = "Hidden folders: hide"
statusText = "Hidden folders: hidden"
}
go func() {
time.Sleep(3 * time.Second)
......
......@@ -6,18 +6,18 @@ import (
"github.com/faiface/beep"
)
type RateLimitedStreamer struct {
type rateLimitedStreamer struct {
streamer beep.Streamer
rate time.Duration
last time.Time
}
func NewRateLimitedStreamer(streamer beep.Streamer, rate time.Duration) *RateLimitedStreamer {
s := RateLimitedStreamer{streamer: streamer, rate: rate}
func newRateLimitedStreamer(streamer beep.Streamer, rate time.Duration) *rateLimitedStreamer {
s := rateLimitedStreamer{streamer: streamer, rate: rate}
return &s
}
func (s *RateLimitedStreamer) Stream(samples [][2]float64) (n int, ok bool) {
func (s *rateLimitedStreamer) Stream(samples [][2]float64) (n int, ok bool) {
if time.Since(s.last) < s.rate {
time.Sleep(time.Until(s.last.Add(s.rate)))
}
......@@ -26,6 +26,6 @@ func (s *RateLimitedStreamer) Stream(samples [][2]float64) (n int, ok bool) {
return s.streamer.Stream(samples)
}
func (s *RateLimitedStreamer) Err() error {
func (s *rateLimitedStreamer) Err() error {
return s.streamer.Err()
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment