From d8575a6522c33c86009bae21408dff5d5cc28b7a Mon Sep 17 00:00:00 2001 From: Raju Ghorai Date: Tue, 7 Feb 2023 20:10:54 +0530 Subject: [PATCH] remove tests config --- .github/workflows/tests.yml | 45 ------------------------------------- src/app/urlparser.go | 2 +- src/cmd/root.go | 3 ++- src/config.go | 15 +++---------- 4 files changed, 6 insertions(+), 59 deletions(-) delete mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index 7a5647a..0000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: CI - -on: - workflow_dispatch: - push: - branches: - - '**' - pull_request: - types: [ opened, reopened ] - -jobs: - tests: - strategy: - matrix: - go-version: [ 1.18.x ] - os: [ ubuntu-latest ] - - runs-on: ${{ matrix.os }} - - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Setup Go - uses: actions/setup-go@v3 - with: - go-version: ${{ matrix.go-version }} - - - name: Install Dependencies - run: go mod download - - - name: Test - run: go test ./... -race -coverprofile=coverage.txt -covermode=atomic -gcflags=-l - - # Generate a Codecov report - - name: Upload coverage report - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - file: ./coverage.txt - flags: unittests - name: go-wallheven [${{ matrix.go-version }}] - fail_ci_if_error: true - path_to_write_report: ./coverage/codecov_report.gz - verbose: true diff --git a/src/app/urlparser.go b/src/app/urlparser.go index f1745eb..3617f07 100644 --- a/src/app/urlparser.go +++ b/src/app/urlparser.go @@ -73,7 +73,7 @@ func (p Param) getFullURL() string { return src.BASE_CONFIG.GetURL(p.String()) } -func GetFullURL(page int, categories string, purity string, sorting string, color string, query string) (string, error) { +func GetFullURL(page int, categories, purity, sorting, color, query string) (string, error) { params := Param{ Page: page, CTage: src.CTAGS[categories], diff --git a/src/cmd/root.go b/src/cmd/root.go index ad29667..7990eff 100644 --- a/src/cmd/root.go +++ b/src/cmd/root.go @@ -4,8 +4,9 @@ import ( "fmt" "os" - "github.com/coderj001/go-wallheven/src/app" "github.com/spf13/cobra" + + "github.com/coderj001/go-wallheven/src/app" ) var ( diff --git a/src/config.go b/src/config.go index 4cdc147..78d681f 100644 --- a/src/config.go +++ b/src/config.go @@ -3,16 +3,14 @@ package src import ( "fmt" "os" - "strconv" "github.com/joho/godotenv" ) type Config struct { - APIURL string - APIKEY string - DIR string - NUMGOROUTINES int + APIURL string + APIKEY string + DIR string } // Base Config @@ -99,12 +97,6 @@ func init() { BASE_CONFIG.DIR = "./tmp" } else { BASE_CONFIG.DIR = os.Getenv("DIR") - - } - if os.Getenv("NUMGOROUTINES") == "" { - BASE_CONFIG.NUMGOROUTINES = 5 - } else { - BASE_CONFIG.NUMGOROUTINES, _ = strconv.Atoi(os.Getenv("NUMGOROUTINES")) } } @@ -120,5 +112,4 @@ func (c Config) getAPIKey() string { func (c Config) GetURL(query string) string { return c.getAPIKey() + query - }