Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

Commit

Permalink
refactor: rename Pool() to dispel any confusion
Browse files Browse the repository at this point in the history
  • Loading branch information
clement2026 committed Sep 22, 2023
1 parent a371083 commit c89d08d
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 7 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: go build and test

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:

buid-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'

- name: Build
run: go build -v ./...

- name: Test
run: go test -v ./...
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@ This repository offers an array of pre-compiled resources, serving as a demonstr
```go
package main

import "fmt"
import "github.com/proxoar/talk-demo-resource/demo"
import (
"fmt"

demo "github.com/proxoar/talk-demo-resource"
)

func main() {
pool, err := Pool()
pool, err := demo.NewResourcePool()
if err != nil {
panice(err)
panic(err)
}
if pool.Len() == 0 {
panice(err)
panic(err)
}
fmt.Println("resource pool len", pool.Len())
for _, re := range pool.List() {
Expand Down
2 changes: 1 addition & 1 deletion list.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func newResourcePool(list []Resource) *ResourcePool {
}
}

func Pool() (*ResourcePool, error) {
func NewResourcePool() (*ResourcePool, error) {
entries, err := assets.ReadDir(dirName)
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

func TestList(t *testing.T) {
pool, err := Pool()
pool, err := NewResourcePool()
if err != nil {
t.Fatal(err)
return
Expand Down

0 comments on commit c89d08d

Please sign in to comment.