Restore Policy options added (#350)
* Issue #349: Added policy for restore to code base. Policy Items are placed in the `internal/common` directory
This commit is contained in:
parent
625cf744a6
commit
0422b9ecbe
19
.github/workflows/lint.yml
vendored
19
.github/workflows/lint.yml
vendored
@ -21,9 +21,28 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
go-version: 1.18
|
go-version: 1.18
|
||||||
|
|
||||||
|
- name: Cache Go build
|
||||||
|
uses: actions/cache@v3
|
||||||
|
id: mybuild
|
||||||
|
with:
|
||||||
|
path: ~/.cache/go-build
|
||||||
|
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum')}}
|
||||||
|
|
||||||
|
- name: Cache Go Mod
|
||||||
|
uses: actions/cache@v3
|
||||||
|
id: cache
|
||||||
|
with:
|
||||||
|
path: ~/go/pkg/mod
|
||||||
|
key: ${{ runner.os }}-go-mod${{ hashFiles('**/go.sum')}}
|
||||||
|
|
||||||
- name: Download package dependencies
|
- name: Download package dependencies
|
||||||
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
run: go mod download
|
run: go mod download
|
||||||
|
|
||||||
|
- name: Build for Lint
|
||||||
|
if: steps.mybuild.outputs.cache-hit != 'true'
|
||||||
|
run: go build ./...
|
||||||
|
|
||||||
- name: Go Lint
|
- name: Go Lint
|
||||||
uses: golangci/golangci-lint-action@v3.2.0
|
uses: golangci/golangci-lint-action@v3.2.0
|
||||||
with:
|
with:
|
||||||
|
|||||||
12
src/internal/common/policy.go
Normal file
12
src/internal/common/policy.go
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
package common
|
||||||
|
|
||||||
|
// Policy is a type that defines the actions taken
|
||||||
|
type RestorePolicy int
|
||||||
|
|
||||||
|
//go:generate stringer -type=RestorePolicy
|
||||||
|
const (
|
||||||
|
Unknown RestorePolicy = iota
|
||||||
|
Copy
|
||||||
|
Drop
|
||||||
|
Replace
|
||||||
|
)
|
||||||
26
src/internal/common/restorepolicy_string.go
Normal file
26
src/internal/common/restorepolicy_string.go
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// Code generated by "stringer -type=RestorePolicy"; DO NOT EDIT.
|
||||||
|
|
||||||
|
package common
|
||||||
|
|
||||||
|
import "strconv"
|
||||||
|
|
||||||
|
func _() {
|
||||||
|
// An "invalid array index" compiler error signifies that the constant values have changed.
|
||||||
|
// Re-run the stringer command to generate them again.
|
||||||
|
var x [1]struct{}
|
||||||
|
_ = x[Unknown-0]
|
||||||
|
_ = x[Copy-1]
|
||||||
|
_ = x[Drop-2]
|
||||||
|
_ = x[Replace-3]
|
||||||
|
}
|
||||||
|
|
||||||
|
const _RestorePolicy_name = "UnknownCopyDropReplace"
|
||||||
|
|
||||||
|
var _RestorePolicy_index = [...]uint8{0, 7, 11, 15, 22}
|
||||||
|
|
||||||
|
func (i RestorePolicy) String() string {
|
||||||
|
if i < 0 || i >= RestorePolicy(len(_RestorePolicy_index)-1) {
|
||||||
|
return "RestorePolicy(" + strconv.FormatInt(int64(i), 10) + ")"
|
||||||
|
}
|
||||||
|
return _RestorePolicy_name[_RestorePolicy_index[i]:_RestorePolicy_index[i+1]]
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user