Skip to content

Commit

Permalink
fix: go lint issue
Browse files Browse the repository at this point in the history
  • Loading branch information
pyadav committed Feb 27, 2024
1 parent 61d6789 commit 3ab9315
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 8 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/lint.yaml
@@ -0,0 +1,24 @@
name: Lint

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

jobs:
golangci:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
with:
go-version: "1.21.6"
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.55.2
working-directory: gateway
8 changes: 7 additions & 1 deletion gateway/Makefile
Expand Up @@ -7,7 +7,13 @@ vet:
@echo "🧹 Vetting go.mod.."
$(GO) vet ./...

build: gen vet ## build AI Gateway server
lint: ## Run linters
golangci-lint run

lint-fix:
golangci-lint run --fix

build: gen vet ## Build AI Gateway server
scripts/build.sh
.PHONY: build

Expand Down
3 changes: 1 addition & 2 deletions gateway/config/init.go
Expand Up @@ -2,7 +2,6 @@ package config

import (
"errors"
"io/ioutil"
"os"
"path/filepath"

Expand Down Expand Up @@ -32,7 +31,7 @@ func Init(configFile string) error {
}
}

if err := ioutil.WriteFile(configFile, data, 0o655); err != nil {
if err := os.WriteFile(configFile, data, 0o655); err != nil {
return err
}

Expand Down
6 changes: 2 additions & 4 deletions gateway/internal/providers/azure/base.go
Expand Up @@ -4,7 +4,6 @@ import (
_ "embed"

"github.com/missingstudio/studio/backend/internal/providers/base"
"github.com/missingstudio/studio/backend/models"
)

//go:embed schema.json
Expand All @@ -15,7 +14,6 @@ var _ base.IProvider = &azureProvider{}
type azureProvider struct {
info base.ProviderInfo
config base.ProviderConfig
conn models.Connection
}

func (anyscale azureProvider) Info() base.ProviderInfo {
Expand All @@ -30,15 +28,15 @@ func (az azureProvider) Schema() []byte {
return schema
}

func getAzureInfo() base.ProviderInfo {
func GetAzureInfo() base.ProviderInfo {
return base.ProviderInfo{
Title: "Azure",
Name: "azure",
Description: "Azure OpenAI Service offers industry-leading coding and language AI models that you can fine-tune to your specific needs for a variety of use cases.",
}
}

func getAzureConfig() base.ProviderConfig {
func GetAzureConfig() base.ProviderConfig {
return base.ProviderConfig{
BaseURL: "",
ChatCompletions: "/chat/completions",
Expand Down
2 changes: 1 addition & 1 deletion gateway/pkg/cache/consul_test.go
Expand Up @@ -80,7 +80,7 @@ func TestGetSuccess(t *testing.T) {

resBytes, err := json.Marshal(response)
assert.Nil(t, err)
res.Write(resBytes)
_, _ = res.Write(resBytes)
})

ts := httptest.NewServer(mux)
Expand Down

0 comments on commit 3ab9315

Please sign in to comment.