Skip to content

Commit

Permalink
Edit ci and code and add .goreleaser.yml and .golangci.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
debug-ing committed Jan 11, 2025
1 parent 720348f commit fec3f9f
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 5 deletions.
Binary file modified .DS_Store
Binary file not shown.
15 changes: 15 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,23 @@ name: ci
on:
- push
jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: latest
args: --timeout=30m
build:
runs-on: ubuntu-latest
needs:
- lint
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
Expand Down
33 changes: 33 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
linters:
disable-all: true
enable:
- govet
- staticcheck
- gocritic
- gosec
- gofmt
- goimports
- errcheck
- gosimple
- unused
- unconvert
- goconst
- gocyclo
- revive

linters-settings:
wrapcheck:
ignoreSigs:
- .JSON
- .NewHTTPError
- .Redirect
- .NoContent
- .Errorf(
- errors.New(
- errors.Unwrap(
- .Wrap(
- .Wrapf(
- .WithMessage(
- .WithMessagef(
- .WithStack(
15 changes: 15 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
project_name: radio-music
builds:
- main: ./cmd/main.go
goos:
- linux
- darwin
- windows
goarch:
- amd64
- arm64
release:
github:
owner: debug-ing
name: radio-music
2 changes: 0 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ type Config struct {
}
}

var configPublic *Config
var once sync.Once

func LoadConfig(address string) (config *Config) {
Expand All @@ -26,7 +25,6 @@ func LoadConfig(address string) (config *Config) {
if err := viper.Unmarshal(&config); err != nil {
panic("ERROR load config file!")
}
configPublic = config
log.Println("================ Loaded Configuration ================")
})
return
Expand Down
2 changes: 1 addition & 1 deletion internal/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (c *Client) GetClients() []chan []byte {
}

// HandleClient handles the client
func (c *Client) HandleClient(w http.ResponseWriter, r *http.Request) {
func (c *Client) HandleClient(w http.ResponseWriter, _ *http.Request) {
client := c.AddClient()
defer c.RemoveClient(client)
w.Header().Set("Content-Type", "audio/mpeg")
Expand Down
3 changes: 1 addition & 2 deletions internal/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package internal

import (
"fmt"
"io/ioutil"
"log"
"os"
"strings"
Expand All @@ -27,7 +26,7 @@ var (
)

func getPlaylist(folderPath string) ([]string, error) {
files, err := ioutil.ReadDir(folderPath)
files, err := os.ReadDir(folderPath)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit fec3f9f

Please sign in to comment.