Skip to content

Commit

Permalink
add go-client workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
wyyolo committed Feb 6, 2024
1 parent 05a6259 commit e195a24
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 6 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/go-client.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name : go-client
on:
pull_request:
jobs:
Go-unit-tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
go-version: [ '1.21.x' ]
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- uses: acifani/setup-tinygo@v2
with:
tinygo-version: '0.30.0'

- name: build
working-directory: ./streampipes-client-go
run: go build -v ./...

- name: Run unit-tests
working-directory: ./streampipes-client-go
run: |
go test ./...
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package StreamPipesHttp

import (
"fmt"
"io/ioutil"
"io"
"log"
"net/http"
"streampipes-client-go/streampipes/internal/StatuCode"
Expand Down Expand Up @@ -50,7 +50,7 @@ func (d *DeleteRequest) ExecuteRequest(serializerStruct interface{}) interface{}
log.Fatal(StatuCode.MethodNotAllowed.Code(), StatuCode.MethodNotAllowed.Message())
default:
defer d.HttpRequest.Response.Body.Close()
body, _ := ioutil.ReadAll(d.HttpRequest.Response.Body)
body, _ := io.ReadAll(d.HttpRequest.Response.Body)
log.Fatal(d.HttpRequest.Response.Status, string(body))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package StreamPipesHttp

import (
"io/ioutil"
"io"
"log"
"net/http"
"streampipes-client-go/streampipes/internal/StatuCode"
Expand Down Expand Up @@ -47,7 +47,7 @@ func (g *GetRequest) ExecuteRequest(serializerStruct interface{}) interface{} {
log.Fatal(StatuCode.MethodNotAllowed.Code(), StatuCode.MethodNotAllowed.Message())
default:
defer g.HttpRequest.Response.Body.Close()
body, _ := ioutil.ReadAll(g.HttpRequest.Response.Body)
body, _ := io.ReadAll(g.HttpRequest.Response.Body)
log.Fatal(g.HttpRequest.Response.Status, string(body))
}

Expand All @@ -58,7 +58,7 @@ func (g *GetRequest) ExecuteRequest(serializerStruct interface{}) interface{} {
func (g *GetRequest) afterRequest() {
//Process complete GET requests
defer g.HttpRequest.Response.Body.Close()
body, err := ioutil.ReadAll(g.HttpRequest.Response.Body)
body, err := io.ReadAll(g.HttpRequest.Response.Body)
if err != nil {
log.Fatal(err)
}
Expand Down
2 changes: 1 addition & 1 deletion streampipes-client-go/streampipes/model/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (

// Generate random letters
func RandomLetters(length int) string {
rand.Seed(time.Now().UnixNano())
rand.NewSource(time.Now().UnixNano())
letterRunes := []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") //Define the alphabet
result := make([]rune, length)
for i := range result {
Expand Down

0 comments on commit e195a24

Please sign in to comment.