Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
version: "2"

run:
tests: false

linters:
settings:
dupl:
threshold: 100

gomoddirectives:
replace-allow-list:
- github.com/linode/linodego

govet:
disable:
- shadow

revive:
rules:
- name: unused-parameter
severity: warning
disabled: true

staticcheck:
checks: ["all", "-ST1005"]

exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
paths:
- third_party$
- builtin$
- examples$

formatters:
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
14 changes: 4 additions & 10 deletions driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@ import (
"encoding/json"
"fmt"
"net"
"net/http"
"os"
"path"
"strconv"
"strings"
"sync"
"time"

"golang.org/x/oauth2"

"github.com/docker/go-plugins-helpers/volume"
metadata "github.com/linode/go-metadata"
"github.com/linode/linodego"
Expand Down Expand Up @@ -72,16 +69,13 @@ func (driver *linodeVolumeDriver) linodeAPI() (*linodego.Client, error) {
}

func setupLinodeAPI(token string) *linodego.Client {
tokenSource := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: token})
oauth2Client := &http.Client{
Transport: &oauth2.Transport{
Source: tokenSource,
},
}
api := linodego.NewClient(nil)

api := linodego.NewClient(oauth2Client)
ua := fmt.Sprintf("docker-volume-linode/%s linodego/%s", VERSION, linodego.Version)
api.SetUserAgent(ua)

api.SetToken(token)

return &api
}

Expand Down
2 changes: 1 addition & 1 deletion fs_utils_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func GetFSType(device string) string {
for _, v := range strings.Split(string(out), " ") {
if strings.Contains(v, "TYPE=") {
fsType = strings.Split(v, "=")[1]
fsType = strings.Replace(fsType, "\"", "", -1)
fsType = strings.ReplaceAll(fsType, "\"", "")
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion integration-test/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
label: "{{ label }}"
type: "{{ type }}"
region: "{{ region }}"
image: linode/ubuntu23.10
image: linode/ubuntu24.04
booted: true
metadata:
user_data: '{{ lookup("template", playbook_dir ~ "/harden.yaml.j2") }}'
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func getEnv(name string) (string, bool) {
}

name = strings.ToUpper(name)
name = strings.Replace(name, "-", "_", -1)
name = strings.ReplaceAll(name, "-", "_")

if val, found := os.LookupEnv(name); found {
return val, true
Expand Down