Skip to content

Commit

Permalink
Merge pull request #5 from DarkCoder26/TestWorkflow
Browse files Browse the repository at this point in the history
Solved go version workflow error
  • Loading branch information
PreetinderSinghBadesha authored Jun 15, 2024
2 parents d195891 + 5a3d7b2 commit b8ada4f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/check-pull-requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.20
go-version: 1.20.4

- name: Install dependencies
run: cd backend && go mod tidy
run: go mod tidy
working-directory: ./backend

- name: Wait for Redis to be ready
run: |
Expand All @@ -45,7 +46,9 @@ jobs:
# - name: Run tests
# env:
# REDIS_URL: redis://localhost:6379
# run: cd backend && go test ./...
# run: go test ./...
# working-directory: ./backend

- name: Build the project
run: cd backend && go build -v -o main main.go
run: go build -v -o main main.go
working-directory: ./backend
8 changes: 4 additions & 4 deletions backend/pkg/router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ func GetAllLinks(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("No links found"))
return
}
err := json.NewEncoder(w).Encode(links)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
var linksData []string
for _, link := range links {
// w.Write([]byte(fmt.Sprintf("%s - %s\n", link.ShortURL, link.Link)))
linksData = append(linksData, fmt.Sprintf("%s - %s\n", link.ShortURL, link.Link))
}
page.Execute(w, linksData)
}
Expand Down

0 comments on commit b8ada4f

Please sign in to comment.