Skip to content
This repository has been archived by the owner on Oct 22, 2021. It is now read-only.

Commit

Permalink
fix:correct mistakes after review
Browse files Browse the repository at this point in the history
  • Loading branch information
zxy-lgtm committed Sep 28, 2021
2 parents 1580e59 + 8daee1b commit 5932853
Show file tree
Hide file tree
Showing 9 changed files with 96 additions and 109 deletions.
36 changes: 0 additions & 36 deletions .github/workflows/auto-build.yml

This file was deleted.

55 changes: 55 additions & 0 deletions .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Dependabot Auto Build
on: pull_request_target

permissions:
pull-requests: write
contents: write

jobs:
metadata:
runs-on: ubuntu-latest
outputs:
dependency-names: ${{ steps.metadata.outputs.dependency-names }}
steps:
- name: Dependabot metadata
uses: Xuanwo/fetch-metadata@v1.2.2
id: metadata
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

dependabot:
needs: metadata
if: ${{ needs.metadata.outputs.dependency-names != '' }}
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: "1.16"

- name: Checkout repository
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.ROBOT_GITHUB_TOKEN }}

- name: Auto build
run: make build

- name: Auto commit
uses: stefanzweifel/git-auto-commit-action@v4
if: ${{contains(needs.metadata.outputs.dependency-names, 'github.com/beyondstorage/go-storage/v4')}}
with:
commit_message: Auto build to generate code

- name: Auto merge
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.ROBOT_GITHUB_TOKEN }}

- name: Auto approve
run: gh pr review "$PR_URL" -a
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.ROBOT_GITHUB_TOKEN }}
26 changes: 26 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: "Build Test"

on: [ push,pull_request ]

jobs:
build_test:
name: Build Test
runs-on: ubuntu-latest

steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: "1.16"

- name: Checkout repository
uses: actions/checkout@v2

- name: Format
run: if [ "$(gofmt -l . | wc -l)" -gt 0 ]; then exit 1; fi

- name: Build
run: make build

- name: Git Diff
run: if [ "$(git diff | wc -l)" -gt 0 ]; then exit 1; fi
66 changes: 0 additions & 66 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: "Unit Test"

on: [push,pull_request]
on: [ push,pull_request ]

jobs:
unit_test:
Expand All @@ -10,7 +10,7 @@ jobs:
strategy:
matrix:
go: [ "1.15", "1.16" ]
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ ubuntu-latest, windows-latest, macos-latest ]

steps:
- name: Set up Go 1.x
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
SHELL := /bin/bash

-include Makefile.env

.PHONY: all check format lint build test generate tidy

help:
Expand Down
2 changes: 0 additions & 2 deletions Makefile.env

This file was deleted.

8 changes: 8 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/Xuanwo/templateutils v0.1.0 h1:WpkWOqQtIQ2vAIpJLa727DdN8WtxhUkkbDGa6UhntJY=
github.com/Xuanwo/templateutils v0.1.0/go.mod h1:OdE0DJ+CJxDBq6psX5DPV+gOZi8bhuHuVUpPCG++Wb8=
<<<<<<< HEAD
github.com/beyondstorage/go-integration-test/v4 v4.5.0 h1:PMrB+aWd6yNwlrJSJOjqNLJtujsKderoSkG9/QOEQr0=
github.com/beyondstorage/go-integration-test/v4 v4.5.0/go.mod h1:o0pHhyaRR/OO6QxnRqWW3aFjTycBZjoKSdHKN/JZRjo=
github.com/beyondstorage/go-storage/v4 v4.0.0/go.mod h1:oa2dYco+xplPj99WSBnYVw/xXvRkIKWSSVDQKNZ5Kz8=
Expand All @@ -47,6 +48,10 @@ github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5P
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
=======
github.com/beyondstorage/go-storage/v4 v4.6.0 h1:a05dtbYjMZB7LrUSvVzzHwlx33B4yEmd5oQB7Itk7VY=
github.com/beyondstorage/go-storage/v4 v4.6.0/go.mod h1:mc9VzBImjXDg1/1sLfta2MJH79elfM6m47ZZvZ+q/Uw=
>>>>>>> 8daee1be276a1ff33d44734275d58ac5b0bb1a73
github.com/dave/dst v0.26.2 h1:lnxLAKI3tx7MgLNVDirFCsDTlTG9nKTk7GcptKcWSwY=
github.com/dave/dst v0.26.2/go.mod h1:UMDJuIRPfyUCC78eFuB+SV/WI8oDeyFDvM/JR6NI3IU=
github.com/dave/gopackages v0.0.0-20170318123100-46e7023ec56e/go.mod h1:i00+b/gKdIDIxuLDFob7ustLAVqhsZRk2qVZrArELGQ=
Expand Down Expand Up @@ -106,6 +111,7 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
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/pprof v0.0.0-20181127221834-b4f47329b966/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
<<<<<<< HEAD
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
Expand All @@ -116,6 +122,8 @@ github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hf
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
=======
>>>>>>> 8daee1be276a1ff33d44734275d58ac5b0bb1a73
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
Expand Down
6 changes: 3 additions & 3 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func newStorager(pairs ...typ.Pair) (store *Storage, err error) {
return nil, services.PairUnsupportedError{Pair: ps.WithCredential(opt.Credential)}
}

// create new minio client
// create new onedrive client
client := getClient(context.TODO(), string(token))

// generate work dir
Expand Down Expand Up @@ -148,7 +148,7 @@ func (s *Storage) formatObject(v *Item, dir, rp string) *typ.Object {
return s.formatFileObject(v, dir, rp)
}

// formatFolderObject format a minio folder object into go-storage object
// formatFolderObject format a onedrive folder object into go-storage object
func (s *Storage) formatFolderObject(v *Item, dir, rp string) (o *typ.Object) {
o = s.newObject(true)

Expand All @@ -162,7 +162,7 @@ func (s *Storage) formatFolderObject(v *Item, dir, rp string) (o *typ.Object) {
return o
}

// formatFolderObject format a minio file object into go-storage object
// formatFolderObject format a onedrive file object into go-storage object
func (s *Storage) formatFileObject(v *Item, dir, rp string) (o *typ.Object) {
o = s.newObject(true)

Expand Down

0 comments on commit 5932853

Please sign in to comment.