mirror of https://github.com/harness/drone.git
makefile build rule modified, ioutil deprecated removed
parent
66f2dadb7a
commit
78d5794221
2
Makefile
2
Makefile
|
@ -40,7 +40,7 @@ generate: $(mocks) cli/server/wire_gen.go mocks/mock_client.go
|
|||
|
||||
build: generate ## Build the gitness service binary
|
||||
@echo "Building Gitness Server"
|
||||
CGO_ENABLED=0 go build -ldflags="-X github.com/harness/gitness/version.GitCommit=${GIT_COMMIT} -X github.com/harness/gitness/version.Version=${GITNESS_VERSION}" -o ./gitness .
|
||||
go build -ldflags="-X github.com/harness/gitness/version.GitCommit=${GIT_COMMIT} -X github.com/harness/gitness/version.Version.Major=${GITNESS_VERSION}" -o ./gitness .
|
||||
|
||||
test: generate ## Run the go tests
|
||||
@echo "Running tests"
|
||||
|
|
|
@ -7,7 +7,7 @@ package cli
|
|||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/harness/gitness/cli/util"
|
||||
|
@ -38,7 +38,7 @@ func (c *loginCommand) run(*kingpin.ParseContext) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return ioutil.WriteFile(path, data, OwnerReadWrite)
|
||||
return os.WriteFile(path, data, OwnerReadWrite)
|
||||
}
|
||||
|
||||
// helper function to register the logout command.
|
||||
|
|
|
@ -7,7 +7,7 @@ package cli
|
|||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/harness/gitness/cli/util"
|
||||
|
@ -37,7 +37,7 @@ func (c *registerCommand) run(*kingpin.ParseContext) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return ioutil.WriteFile(path, data, OwnerReadWrite)
|
||||
return os.WriteFile(path, data, OwnerReadWrite)
|
||||
}
|
||||
|
||||
// helper function to register the register command.
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
package cli
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"github.com/harness/gitness/internal/api/openapi"
|
||||
|
@ -23,7 +22,7 @@ func (c *swaggerCommand) run(*kingpin.ParseContext) error {
|
|||
os.Stdout.Write(data)
|
||||
return nil
|
||||
}
|
||||
return ioutil.WriteFile(c.path, data, OwnerReadWrite)
|
||||
return os.WriteFile(c.path, data, OwnerReadWrite)
|
||||
}
|
||||
|
||||
// helper function to register the swagger command.
|
||||
|
|
|
@ -9,7 +9,6 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
@ -30,7 +29,7 @@ func Client() (*client.HTTPClient, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
data, err := ioutil.ReadFile(path)
|
||||
data, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
"crypto/tls"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
|
@ -93,7 +93,7 @@ func (a *Authorizer) CheckAll(ctx context.Context, principalType enum.PrincipalT
|
|||
return false, fmt.Errorf("got unexpected status code '%d' - assume unauthorized", response.StatusCode)
|
||||
}
|
||||
|
||||
bodyByte, err := ioutil.ReadAll(response.Body)
|
||||
bodyByte, err := io.ReadAll(response.Body)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package database
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"github.com/jmoiron/sqlx"
|
||||
|
@ -56,7 +55,7 @@ func seed(db *sqlx.DB) error {
|
|||
|
||||
// unmarshal a testdata file.
|
||||
func unmarshal(path string, v interface{}) error {
|
||||
out, err := ioutil.ReadFile(path)
|
||||
out, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue