Skip to content

Commit

Permalink
Merge pull request #13 from mutablelogic/v1
Browse files Browse the repository at this point in the history
Updated to go version 1.21
  • Loading branch information
djthorpe authored May 9, 2024
2 parents 9460f7e + 5a18210 commit 57daf37
Show file tree
Hide file tree
Showing 73 changed files with 100 additions and 83 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [ '1.19', '1.20', '1.21', '1.22' ]
go-version: [ '1.21', '1.22' ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ cmd: $(CMD_DIR)

test:
@${GO} mod tidy
@${GO} test -v ./pkg/...
@${GO} test ./pkg/...

$(CMD_DIR): dependencies mkdir
@echo Build cmd $(notdir $@)
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ There are also some example clients which use this library:
* [Ollama API client](https://github.com/mutablelogic/go-client/tree/main/pkg/ollama)
* [OpenAI API client](https://github.com/mutablelogic/go-client/tree/main/pkg/openai)

Aiming to have compatibility with go version 1.19 and above.
Aiming to have compatibility with go version 1.21 and above.

## Basic Usage

Expand All @@ -33,7 +33,7 @@ to a JSON endpoint:
package main

import (
client "github.com/mutablelogic/go-client/pkg/client"
client "github.com/mutablelogic/go-client"
)

func main() {
Expand Down Expand Up @@ -85,7 +85,7 @@ For example,
package main

import (
client "github.com/mutablelogic/go-client/pkg/client"
client "github.com/mutablelogic/go-client"
)

func main() {
Expand Down Expand Up @@ -160,7 +160,7 @@ The authentication token can be set as follows:
package main

import (
client "github.com/mutablelogic/go-client/pkg/client"
client "github.com/mutablelogic/go-client"
)

func main() {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion pkg/client/client_test.go → client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package client_test
import (
"testing"

"github.com/mutablelogic/go-client/pkg/client"
"github.com/mutablelogic/go-client"
"github.com/stretchr/testify/assert"
)

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions cmd/cli/elevenlabs.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"regexp"
"strings"

// Package imports
"github.com/mutablelogic/go-client/pkg/client"
// Packages
"github.com/mutablelogic/go-client"
"github.com/mutablelogic/go-client/pkg/elevenlabs"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/cli/homeassistant.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package main

import (
// Packages
"github.com/mutablelogic/go-client/pkg/client"
"github.com/mutablelogic/go-client"
"github.com/mutablelogic/go-client/pkg/homeassistant"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/cli/ipify.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package main

import (
// Packages
"github.com/mutablelogic/go-client/pkg/client"
"github.com/mutablelogic/go-client"
"github.com/mutablelogic/go-client/pkg/ipify"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"path"

// Packages
"github.com/mutablelogic/go-client/pkg/client"
"github.com/mutablelogic/go-client"
"github.com/pkg/errors"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/cli/mistral.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package main

import (
// Package imports
"github.com/mutablelogic/go-client/pkg/client"
"github.com/mutablelogic/go-client"
"github.com/mutablelogic/go-client/pkg/mistral"
"github.com/mutablelogic/go-client/pkg/openai/schema"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/cli/newsapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package main

import (
// Package imports
"github.com/mutablelogic/go-client/pkg/client"
"github.com/mutablelogic/go-client"
"github.com/mutablelogic/go-client/pkg/newsapi"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/cli/ollama.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package main

import (
// Package imports
"github.com/mutablelogic/go-client/pkg/client"
"github.com/mutablelogic/go-client"
"github.com/mutablelogic/go-client/pkg/ollama"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/cli/openai.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"regexp"
"strconv"

"github.com/mutablelogic/go-client/pkg/client"
"github.com/mutablelogic/go-client"
"github.com/mutablelogic/go-client/pkg/openai"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/client/doc.go → doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ gateway-specific clients. Basic usage:
package main
import (
client "github.com/mutablelogic/go-client/pkg/client"
client "github.com/mutablelogic/go-client"
)
func main() {
Expand Down
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module github.com/mutablelogic/go-client

go 1.19
go 1.22

toolchain go1.22.3

require (
github.com/andreburgaud/crypt2go v1.5.0
Expand Down
1 change: 1 addition & 0 deletions pkg/client/payload.go → payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"net/http"
"strconv"

// Packages
"github.com/mutablelogic/go-client/pkg/multipart"
)

Expand Down
7 changes: 3 additions & 4 deletions pkg/client/payload_test.go → payload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ import (
"testing"

// Packages
"github.com/mutablelogic/go-client/pkg/client"
"github.com/mutablelogic/go-client"
"github.com/stretchr/testify/assert"
)

func Test_payload_001(t *testing.T) {
assert := assert.New(t)
payload := client.NewPayload(client.ContentTypeBinary)
payload := client.NewRequest()
assert.NotNil(payload)
assert.Equal("GET", payload.Method())
assert.Equal(client.ContentTypeJson, payload.Type())
assert.Equal(client.ContentTypeBinary, payload.Accept())
assert.Equal(client.ContentTypeAny, payload.Accept())
}
8 changes: 4 additions & 4 deletions pkg/bitwarden/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ bitwarden implements an API client for bitwarden
package bitwarden

import (
// Packages
"runtime"

"github.com/mutablelogic/go-client/pkg/client"
// Packages
"github.com/mutablelogic/go-client"

// Namespace imports
. "github.com/djthorpe/go-errors"
Expand Down Expand Up @@ -96,10 +96,10 @@ func (c *Client) Prelogin(email, password string) (*Session, error) {

// Prelogin
request.Email = email
payload, err := client.NewJSONRequest(request, client.ContentTypeJson)
payload, err := client.NewJSONRequest(request)
if err != nil {
return nil, err
} else if err := c.Do(payload.Post(), &response.Kdf, client.OptPath("accounts/prelogin")); err != nil {
} else if err := c.Do(payload, &response.Kdf, client.OptPath("accounts/prelogin")); err != nil {
return nil, err
} else if response.Kdf.Iterations == 0 {
return nil, ErrUnexpectedResponse
Expand Down
4 changes: 2 additions & 2 deletions pkg/bitwarden/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"testing"

// Packages
opts "github.com/mutablelogic/go-client"
bitwarden "github.com/mutablelogic/go-client/pkg/bitwarden"
opts "github.com/mutablelogic/go-client/pkg/client"
assert "github.com/stretchr/testify/assert"
)

Expand All @@ -32,7 +32,7 @@ func Test_client_002(t *testing.T) {
t.Log(string(data))
}

func Test_client_003(t *testing.T) {
func DisabledTest_client_003(t *testing.T) { // TODO
assert := assert.New(t)
client, err := bitwarden.New(opts.OptTrace(os.Stderr, true))
assert.NoError(err)
Expand Down
1 change: 1 addition & 0 deletions pkg/bitwarden/crypto_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/json"
"testing"

// Packages
"github.com/mutablelogic/go-client/pkg/bitwarden"
"github.com/stretchr/testify/assert"
)
Expand Down
1 change: 1 addition & 0 deletions pkg/bitwarden/key_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"testing"

// Packages
"github.com/mutablelogic/go-client/pkg/bitwarden"
"github.com/stretchr/testify/assert"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/elevenlabs/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package elevenlabs

import (
// Packages
"github.com/mutablelogic/go-client/pkg/client"
"github.com/mutablelogic/go-client"
)

///////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion pkg/elevenlabs/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"

// Packages
opts "github.com/mutablelogic/go-client/pkg/client"
opts "github.com/mutablelogic/go-client"
elevenlabs "github.com/mutablelogic/go-client/pkg/elevenlabs"
assert "github.com/stretchr/testify/assert"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/elevenlabs/text_to_speech.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"io"

// Packages
"github.com/mutablelogic/go-client/pkg/client"
"github.com/mutablelogic/go-client"
)

///////////////////////////////////////////////////////////////////////////////
Expand Down
4 changes: 1 addition & 3 deletions pkg/elevenlabs/voice.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package elevenlabs

import (

// Packages

"github.com/djthorpe/go-errors"
"github.com/mutablelogic/go-client/pkg/client"
"github.com/mutablelogic/go-client"
)

///////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion pkg/elevenlabs/voice_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"testing"

// Packages
opts "github.com/mutablelogic/go-client/pkg/client"
opts "github.com/mutablelogic/go-client"
elevenlabs "github.com/mutablelogic/go-client/pkg/elevenlabs"
assert "github.com/stretchr/testify/assert"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/homeassistant/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package homeassistant

import (
// Packages
"github.com/mutablelogic/go-client/pkg/client"
"github.com/mutablelogic/go-client"
)

///////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion pkg/homeassistant/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"

// Packages
opts "github.com/mutablelogic/go-client/pkg/client"
opts "github.com/mutablelogic/go-client"
homeassistant "github.com/mutablelogic/go-client/pkg/homeassistant"
assert "github.com/stretchr/testify/assert"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/homeassistant/events.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package homeassistant

import "github.com/mutablelogic/go-client/pkg/client"
import "github.com/mutablelogic/go-client"

///////////////////////////////////////////////////////////////////////////////
// TYPES
Expand Down
2 changes: 1 addition & 1 deletion pkg/homeassistant/events_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"

// Packages
opts "github.com/mutablelogic/go-client/pkg/client"
opts "github.com/mutablelogic/go-client"
homeassistant "github.com/mutablelogic/go-client/pkg/homeassistant"
assert "github.com/stretchr/testify/assert"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/homeassistant/health_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"

// Packages
opts "github.com/mutablelogic/go-client/pkg/client"
opts "github.com/mutablelogic/go-client"
homeassistant "github.com/mutablelogic/go-client/pkg/homeassistant"
assert "github.com/stretchr/testify/assert"
)
Expand Down
3 changes: 2 additions & 1 deletion pkg/homeassistant/states.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import (
"strings"
"time"

"github.com/mutablelogic/go-client/pkg/client"
// Packages
"github.com/mutablelogic/go-client"
)

///////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion pkg/homeassistant/states_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"

// Packages
opts "github.com/mutablelogic/go-client/pkg/client"
opts "github.com/mutablelogic/go-client"
homeassistant "github.com/mutablelogic/go-client/pkg/homeassistant"
assert "github.com/stretchr/testify/assert"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/ipify/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"net/url"

// Packages
"github.com/mutablelogic/go-client/pkg/client"
"github.com/mutablelogic/go-client"
)

///////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion pkg/ipify/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"

// Packages
opts "github.com/mutablelogic/go-client/pkg/client"
opts "github.com/mutablelogic/go-client"
ipify "github.com/mutablelogic/go-client/pkg/ipify"
assert "github.com/stretchr/testify/assert"
)
Expand Down
3 changes: 2 additions & 1 deletion pkg/mistral/chat.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package mistral

import (
client "github.com/mutablelogic/go-client/pkg/client"
// Packages
client "github.com/mutablelogic/go-client"
schema "github.com/mutablelogic/go-client/pkg/openai/schema"

// Namespace imports
Expand Down
Loading

0 comments on commit 57daf37

Please sign in to comment.