diff --git a/.github/workflows/dive.yml b/.github/workflows/dive.yml deleted file mode 100644 index 5c5e7fc..0000000 --- a/.github/workflows/dive.yml +++ /dev/null @@ -1,17 +0,0 @@ ---- -name: Dive CI -'on': push -jobs: - dive: - runs-on: ubuntu-latest - name: Analyze image efficiency - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Build image - run: docker build -t utrecht/yaam:${{ github.sha }} . - - name: Dive - uses: yuichielectric/dive-action@0.0.4 - with: - image: utrecht/yaam:${{ github.sha }} - github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 2006b35..efe4409 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,32 +1,17 @@ --- name: Docker 'on': + # required by gomod-go-version-updater to trigger this action once pr has + # been reviewed + pull_request_review: + types: [submitted] push: - tags: - - '*' jobs: - release: - runs-on: ubuntu-latest + mcvs-docker-action: + runs-on: ubuntu-20.04 steps: - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - name: Login to DockerHub - uses: docker/login-action@v1 + - uses: actions/checkout@v4.1.7 + - uses: schubergphilis/mcvs-docker-action@v0.5.2 with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: version - id: version - run: echo ::set-output name=version::${GITHUB_REF#refs/tags/} - - name: Build and push - id: docker_build - uses: docker/build-push-action@v2 - with: - push: true - tags: utrecht/yaam:${{ steps.version.outputs.version }} - build-args: | - VERSION=${{ github.ref }} - - name: Image digest - run: echo ${{ steps.docker_build.outputs.digest }} + dockle-accept-key: curl,HOME,libcrypto3,libssl3,PATH + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/dockle.yml b/.github/workflows/dockle.yml deleted file mode 100644 index 6a288ee..0000000 --- a/.github/workflows/dockle.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -name: Dockle -'on': push -jobs: - dive: - runs-on: ubuntu-latest - name: Analyze image using dockle - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Build image - run: docker build -t utrecht/yaam:${{ github.sha }} . - - uses: hands-lab/dockle-action@v1 - with: - image: utrecht/yaam:${{ github.sha }} diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml deleted file mode 100644 index 4c19e68..0000000 --- a/.github/workflows/go.yml +++ /dev/null @@ -1,60 +0,0 @@ ---- -name: Go -'on': push -jobs: - build: - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: 1.19.0 - - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: '17' - - uses: actions/setup-node@v3 - with: - node-version: 14 - - name: Unit tests - timeout-minutes: 20 - run: | - go test -timeout=20m -short -cover -v -coverprofile=coverage.txt \ - -covermode=atomic ./... - - uses: codecov/codecov-action@v3 - with: - files: ./coverage.txt - flags: unittests - verbose: true - - name: SonarCloud Scan - uses: sonarsource/sonarcloud-github-action@master - with: - args: > - -Dsonar.organization=030-github - -Dsonar.projectKey=030_yaam - -Dsonar.exclusions=test/testdata/** - -Dsonar.sources=. - -Dsonar.coverage.exclusions=**/*_test.go,test/testdata/** - -Dsonar.verbose=true - -Dsonar.go.coverage.reportPaths="coverage.txt" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - - name: Set YAAM deliverable environment variable - run: echo "yaam-deliverable=yaam-ubuntu-20.04" >> $GITHUB_ENV - - name: Use the value - run: | - echo "${{ env.yaam-deliverable }}" - - name: Build - run: ./scripts/build.sh - env: - YAAM_DELIVERABLE: ${{ env.yaam-deliverable }} - SHA512_CMD: sha512sum - - name: Quality - run: | - docker run --rm -v ${PWD}:/data markdownlint/markdownlint:0.11.0 \ - README.md -s /data/configs/.markdownlint.rb - docker run --rm -v $(pwd):/app -w /app -e GOFLAGS=-buildvcs=false \ - golangci/golangci-lint:v1.50.1-alpine golangci-lint run -v \ - --timeout 2m30s --config configs/.golangci.yml diff --git a/.github/workflows/golang.yml b/.github/workflows/golang.yml new file mode 100644 index 0000000..0da7f6a --- /dev/null +++ b/.github/workflows/golang.yml @@ -0,0 +1,14 @@ +--- +name: Golang +'on': + # required by gomod-go-version-updater to trigger this action once pr has + # been reviewed + pull_request_review: + types: [submitted] + push: +jobs: + mcvs-golang-action: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v4.1.7 + - uses: schubergphilis/mcvs-golang-action@v0.6.1 diff --git a/.github/workflows/gosec.yml b/.github/workflows/gosec.yml deleted file mode 100644 index 51f5e7d..0000000 --- a/.github/workflows/gosec.yml +++ /dev/null @@ -1,34 +0,0 @@ ---- -name: Run Gosec -'on': - push: - branches: - - main - pull_request: - branches: - - main -jobs: - tests: - runs-on: ubuntu-latest - env: - GO111MODULE: 'on' - steps: - - name: Checkout Source - uses: actions/checkout@v2 - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: 1.19.0 - - name: Download gosec - run: | - export GOSEC_URL=https://github.com/securego/gosec/releases/download - export GOSEC_VERSION=2.11.0 - export GOSEC=${GOSEC_URL}/v${GOSEC_VERSION}/gosec_${GOSEC_VERSION} - curl -L ${GOSEC}_linux_amd64.tar.gz -o gosec.tar.gz - tar -xvf gosec.tar.gz - chmod +x gosec - ./gosec --version - - name: Run gosec - run: | - go version - ./gosec ./... diff --git a/.github/workflows/hadolint.yml b/.github/workflows/hadolint.yml deleted file mode 100644 index d52368c..0000000 --- a/.github/workflows/hadolint.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -name: Hadolint -'on': push -jobs: - dive: - runs-on: ubuntu-latest - name: Analyze image using hadolint - steps: - - uses: actions/checkout@v2 - - uses: hadolint/hadolint-action@v2.0.0 - with: - dockerfile: Dockerfile diff --git a/.github/workflows/mcvs-pr-validation.yml b/.github/workflows/mcvs-pr-validation.yml new file mode 100644 index 0000000..e20ddd8 --- /dev/null +++ b/.github/workflows/mcvs-pr-validation.yml @@ -0,0 +1,16 @@ +--- +name: MCVS-PR-validation-action +'on': + pull_request: + types: + - edited + - opened + - reopened + - synchronize + workflow_call: +jobs: + MCVS-PR-validation-action: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4.1.1 + - uses: schubergphilis/mcvs-pr-validation-action@v0.1.1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 7288aea..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,49 +0,0 @@ ---- -name: Release -'on': - push: - tags: - - '*' -jobs: - release: - name: Create Release - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: 1.19.0 - - name: Set YAAM deliverable environment variable - run: echo "yaam-deliverable=yaam-ubuntu-20.04" >> $GITHUB_ENV - - name: Use the value - run: | - echo "${{ env.yaam-deliverable }}" - - name: Check whether all versions have been updated - run: | - version=$(echo "${{ github.ref }}" | sed -e "s|.*\/\(.*\)$|\1|") - echo "Version: ${version}" - echo "Checking README.md..." - grep "yaam:${version}" README.md - echo "Checking k8s-openshift deployment..." - grep "yaam:${version}" deployments/k8s-openshift/deploy.yml - - name: Create release - run: ./scripts/build.sh - env: - YAAM_DELIVERABLE: ${{ env.yaam-deliverable }} - GITHUB_TAG: ${{ github.ref }} - SHA512_CMD: sha512sum - - name: Upload binaries to release - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: cmd/yaam/${{ env.yaam-deliverable }} - asset_name: ${{ env.yaam-deliverable }} - tag: ${{ github.ref }} - - name: Upload checksums - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: cmd/yaam/${{ env.yaam-deliverable }}.sha512.txt - asset_name: ${{ env.yaam-deliverable }}.sha512.txt - tag: ${{ github.ref }} diff --git a/.github/workflows/trivy.yml b/.github/workflows/trivy.yml deleted file mode 100644 index bbc9c2f..0000000 --- a/.github/workflows/trivy.yml +++ /dev/null @@ -1,33 +0,0 @@ ---- -name: Trivy -'on': push -jobs: - build: - name: Build - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - - name: Build an image from Dockerfile - run: | - docker build -t utrecht/yaam:${{ github.sha }} . - - name: Run Trivy vulnerability scanner - uses: aquasecurity/trivy-action@7b7aa264d83dc58691451798b4d117d53d21edfe - with: - image-ref: 'utrecht/yaam:${{ github.sha }}' - format: sarif - output: 'trivy-results.sarif' - severity: 'CRITICAL,HIGH' - - name: Upload Trivy scan results to GitHub Security tab - uses: github/codeql-action/upload-sarif@v2 - with: - sarif_file: 'trivy-results.sarif' - - name: Run Trivy vulnerability scanner - uses: aquasecurity/trivy-action@master - with: - image-ref: 'utrecht/yaam:${{ github.sha }}' - format: 'table' - exit-code: '1' - ignore-unfixed: true - vuln-type: 'os,library' - severity: 'CRITICAL,HIGH' diff --git a/.github/workflows/yamllint.yml b/.github/workflows/yamllint.yml deleted file mode 100644 index 118efb8..0000000 --- a/.github/workflows/yamllint.yml +++ /dev/null @@ -1,16 +0,0 @@ ---- -name: Yamllint -'on': push -jobs: - yamllint: - runs-on: ubuntu-latest - container: - image: pipelinecomponents/yamllint:0.22.1 - env: - YAMLLINT_CONFIG_FILE: /code/configs/.yamllint.yaml - options: --cpus 1 - steps: - - name: Checkout code - uses: actions/checkout@v2 - - name: run yamllint - run: yamllint . diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..cd8791d --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,110 @@ +--- +issues: + exclude-rules: + - linters: + - gochecknoinits + path: cmd/yaam/main_test.go + text: "don't use `init` function" + - linters: + - gochecknoinits + path: internal/app/yaam/artifact/artifact_test.go + text: "don't use `init` function" + - linters: + - gochecknoinits + path: internal/app/yaam/artifact/validate_test.go + text: "don't use `init` function" + - linters: + - gocognit + path: internal/app/path/to/some/file.go + text: 'cognitive complexity 71' +linters: + enable-all: true + disable: + - bodyclose + - cyclop + - durationcheck + - errorlint + - exhaustruct + - forbidigo + - forcetypeassert + - gochecknoglobals + - goconst + - gocritic + - goerr113 + - golint + - gomnd + - lll + - nestif + - nlreturn + - noctx + - nonamedreturns + - paralleltest + - perfsprint + - revive + - stylecheck + - testifylint + - testpackage + - usestdlibvars + - varnamelen + - wrapcheck + - wsl + # + # The following linters have been deprecated + # + - maligned + - ifshort + - structcheck + - exhaustivestruct + - scopelint + - deadcode + - nosnakecase + - interfacer + - varcheck +linters-settings: + depguard: + # Rules to apply. + # + # Variables: + # - File Variables + # you can still use and exclamation mark ! in front of a variable to say + # not to use it. + # Example !$test will match any file that is not a go test file. + # + # `$all` - matches all go files + # `$test` - matches all go test files + # + # - Package Variables + # + # `$gostd` - matches all of go's standard library (Pulled from `GOROOT`) + # + # Default: Only allow $gostd in all files. + rules: + # Name of a rule. + main: + # List of file globs that will match this list of settings to compare + # against. + # Default: $all + files: + - '!**/*_a _file.go' + # List of allowed packages. + allow: + - $gostd + - github.com/030/logging/pkg/logging + - github.com/030/yaam/internal/app/yaam/api + - github.com/030/yaam/internal/app/yaam/artifact + - github.com/030/yaam/internal/app/yaam/file + - github.com/030/yaam/internal/app/yaam/project + - github.com/030/yaam/internal/app/yaam/yaamtest + - github.com/gorilla/mux + - github.com/hashicorp/go-retryablehttp + - github.com/mitchellh/go-homedir + - github.com/sirupsen/logrus + - github.com/spf13/viper + - github.com/stretchr/testify/assert + - github.com/tidwall/gjson + # Packages that are not allowed where the value is a suggestion. + deny: + # - pkg: 'github.com/sirupsen/logrus' + # desc: not allowed + - pkg: 'github.com/pkg/errors' + desc: Should be replaced by standard lib errors package diff --git a/Dockerfile b/Dockerfile index 596ccc5..181ff2f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,17 @@ -FROM golang:1.19.4-alpine3.17 as builder +FROM golang:1.22.4-alpine3.19 as builder ARG VERSION ENV USERNAME=yaam ENV BASE=/opt/${USERNAME} COPY . /go/${USERNAME}/ WORKDIR /go/${USERNAME}/cmd/${USERNAME}/ -RUN apk add --no-cache curl=~7 git=~2 && \ +RUN apk add --no-cache curl=~8 git=~2 && \ CGO_ENABLED=0 go build -ldflags "-X main.Version=${VERSION}" -buildvcs=false && \ curl -sL https://gist.githubusercontent.com/030/54fc7ae735a163c09dcf6f3699d87e81/raw/b82514f50525e0ebf843e0dbf9bef1a382ccd40f/openshift-docker-user-entrypoint.sh > entrypoint.sh && \ curl -sL https://gist.githubusercontent.com/030/34a2bf3f7f1cd427dc36c86dcb1e8cf7/raw/e1be7ef3c2c1a8441e406a669a0f6b6d97dcc984/openshift-docker-user.sh > user.sh && \ chmod +x user.sh && \ ./user.sh -FROM alpine:3.17.0 +FROM alpine:3.20.1 ENV BIN=/usr/local/bin/ ENV USERNAME=yaam ENV BASE=/opt/${USERNAME} diff --git a/cmd/yaam/main_test.go b/cmd/yaam/main_test.go index 1d25829..4a70443 100644 --- a/cmd/yaam/main_test.go +++ b/cmd/yaam/main_test.go @@ -10,7 +10,7 @@ import ( "github.com/030/yaam/internal/app/yaam/project" "github.com/030/yaam/internal/app/yaam/yaamtest" - "github.com/tj/assert" + "github.com/stretchr/testify/assert" ) const ( @@ -49,7 +49,7 @@ func TestMainNpmBuild(t *testing.T) { assert.Equal(t, 0, exitCode) } -// Apt +// Apt. func TestApt(t *testing.T) { resp, _ := yaamtest.GenericArtifactReq("GET", aptUri, nil) defer func() { @@ -73,7 +73,7 @@ subsequently publish a Maven artifact. - GradleCleanBuildGroup - GradleCleanBuildGroupFail - GradlePublish -- GradlePublishFail +- GradlePublishFail. */ func TestGradleCleanBuildGroup(t *testing.T) { repos := []string{"maven/groups/hello"} @@ -124,7 +124,7 @@ Generic: upload an Ubuntu.iso and download it. - Upload - UploadFail - Download -- DownloadFail +- DownloadFail. */ func TestGenericArtifactUpload(t *testing.T) { if err := yaamtest.GenericArtifact(); err != nil { diff --git a/go.mod b/go.mod index 4273a03..e09101d 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/030/yaam -go 1.19 +go 1.22.4 require ( github.com/030/logging v0.1.1 @@ -9,8 +9,8 @@ require ( github.com/mitchellh/go-homedir v1.1.0 github.com/sirupsen/logrus v1.9.0 github.com/spf13/viper v1.14.0 + github.com/stretchr/testify v1.8.1 github.com/tidwall/gjson v1.14.4 - github.com/tj/assert v0.0.3 golang.org/x/exp v0.0.0-20221217163422-3c43f8badb15 ) @@ -28,7 +28,6 @@ require ( github.com/spf13/cast v1.5.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/stretchr/testify v1.8.1 // indirect github.com/subosito/gotenv v1.4.1 // indirect github.com/tidwall/match v1.1.1 // indirect github.com/tidwall/pretty v1.2.1 // indirect diff --git a/go.sum b/go.sum index 714e19b..68fa185 100644 --- a/go.sum +++ b/go.sum @@ -58,7 +58,9 @@ github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5y github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= +github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= +github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= @@ -101,6 +103,7 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -126,6 +129,7 @@ github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9n github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= github.com/hashicorp/go-hclog v1.2.0 h1:La19f8d7WIlm4ogzNHB0JGqs5AUDAZ2UfCY4sJXcJdM= +github.com/hashicorp/go-hclog v1.2.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= github.com/hashicorp/go-retryablehttp v0.7.1 h1:sUiuQAnLlbvmExtFQs72iFW/HXeUn8Z1aJLQ4LJJbTQ= github.com/hashicorp/go-retryablehttp v0.7.1/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= @@ -140,13 +144,17 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= +github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= @@ -162,6 +170,7 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/spf13/afero v1.9.3 h1:41FoI0fD7OR7mGcKE/aOiLkGreyf8ifIOQmJANWogMk= @@ -180,7 +189,6 @@ github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpE github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= @@ -195,8 +203,6 @@ github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JT github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4= github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= -github.com/tj/assert v0.0.3 h1:Df/BlaZ20mq6kuai7f5z2TvPFiwC3xaWJSDQNiIS3Rk= -github.com/tj/assert v0.0.3/go.mod h1:Ne6X72Q+TB1AteidzQncjw9PabbMp4PBMZ1k+vd1Pvk= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -498,7 +504,6 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/internal/app/yaam/artifact/artifact_test.go b/internal/app/yaam/artifact/artifact_test.go index 18aaee0..ff24bac 100644 --- a/internal/app/yaam/artifact/artifact_test.go +++ b/internal/app/yaam/artifact/artifact_test.go @@ -9,7 +9,7 @@ import ( "github.com/030/yaam/internal/app/yaam/project" "github.com/030/yaam/internal/app/yaam/yaamtest" - "github.com/tj/assert" + "github.com/stretchr/testify/assert" ) func init() { @@ -21,6 +21,7 @@ func init() { log.Fatal(err) } } + func TestStoreOnDisk(t *testing.T) { s := strings.NewReader("Hola mundo!") rc := io.NopCloser(s) diff --git a/internal/app/yaam/artifact/npm_test.go b/internal/app/yaam/artifact/npm_test.go index bf6b1d9..92b6501 100644 --- a/internal/app/yaam/artifact/npm_test.go +++ b/internal/app/yaam/artifact/npm_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/030/yaam/internal/app/yaam/yaamtest" - "github.com/tj/assert" + "github.com/stretchr/testify/assert" ) func TestFirstMatch(t *testing.T) { diff --git a/internal/app/yaam/artifact/validate_test.go b/internal/app/yaam/artifact/validate_test.go index e2349e4..57b41f3 100644 --- a/internal/app/yaam/artifact/validate_test.go +++ b/internal/app/yaam/artifact/validate_test.go @@ -7,7 +7,7 @@ import ( "github.com/030/yaam/internal/app/yaam/project" "github.com/030/yaam/internal/app/yaam/yaamtest" log "github.com/sirupsen/logrus" - "github.com/tj/assert" + "github.com/stretchr/testify/assert" ) func init() { diff --git a/internal/app/yaam/file/file_test.go b/internal/app/yaam/file/file_test.go index ffdd231..92c2799 100644 --- a/internal/app/yaam/file/file_test.go +++ b/internal/app/yaam/file/file_test.go @@ -7,13 +7,12 @@ import ( "testing" "github.com/030/yaam/internal/app/yaam/yaamtest" - "github.com/tj/assert" + "github.com/stretchr/testify/assert" ) func TestExists(t *testing.T) { _, exists := Exists("does-not-exist") assert.Equal(t, false, exists) - } func TestEmptyFile(t *testing.T) { diff --git a/internal/app/yaam/project/project_test.go b/internal/app/yaam/project/project_test.go index 98c90bb..15247ef 100644 --- a/internal/app/yaam/project/project_test.go +++ b/internal/app/yaam/project/project_test.go @@ -4,7 +4,7 @@ import ( "regexp" "testing" - "github.com/tj/assert" + "github.com/stretchr/testify/assert" ) func TestHome(t *testing.T) { diff --git a/internal/app/yaam/yaamtest/config.go b/internal/app/yaam/yaamtest/config.go index 80536b6..6e1b0c5 100644 --- a/internal/app/yaam/yaamtest/config.go +++ b/internal/app/yaam/yaamtest/config.go @@ -71,7 +71,7 @@ func Config() error { if err := os.MkdirAll(dir, os.ModePerm); err != nil { return err } - if err := os.WriteFile(filepath.Join(dir, "config.yml"), []byte(conf), 0600); err != nil { + if err := os.WriteFile(filepath.Join(dir, "config.yml"), []byte(conf), 0o600); err != nil { return err } diff --git a/internal/app/yaam/yaamtest/maven.go b/internal/app/yaam/yaamtest/maven.go index 5619e4f..51f4cbb 100644 --- a/internal/app/yaam/yaamtest/maven.go +++ b/internal/app/yaam/yaamtest/maven.go @@ -17,7 +17,7 @@ var ( ) func gradleFile(content []byte, name string) error { - if err := os.WriteFile(filepath.Join(gradleHomeDemoProject, name+".gradle"), content, 0600); err != nil { + if err := os.WriteFile(filepath.Join(gradleHomeDemoProject, name+".gradle"), content, 0o600); err != nil { return err } return nil diff --git a/internal/app/yaam/yaamtest/maven_test.go b/internal/app/yaam/yaamtest/maven_test.go index 94231c5..da35828 100644 --- a/internal/app/yaam/yaamtest/maven_test.go +++ b/internal/app/yaam/yaamtest/maven_test.go @@ -3,7 +3,7 @@ package yaamtest import ( "testing" - "github.com/tj/assert" + "github.com/stretchr/testify/assert" ) func TestGradleFile(t *testing.T) { diff --git a/internal/app/yaam/yaamtest/npm.go b/internal/app/yaam/yaamtest/npm.go index 8287c7a..6508ba9 100644 --- a/internal/app/yaam/yaamtest/npm.go +++ b/internal/app/yaam/yaamtest/npm.go @@ -27,7 +27,7 @@ func NpmConfig() (int, error) { npmrcWithCacheLocation := npmrc + ` cache=` + testDirNpm + `/cache` + time.Now().Format("20060102150405111") + `` - if err := os.WriteFile(filepath.Join(npmHomeDemoProject, ".npmrc"), []byte(npmrcWithCacheLocation), 0600); err != nil { + if err := os.WriteFile(filepath.Join(npmHomeDemoProject, ".npmrc"), []byte(npmrcWithCacheLocation), 0o600); err != nil { return 1, err }