Skip to content

Commit 88b98db

Browse files
committed
fix: linter
1 parent ca49640 commit 88b98db

File tree

4 files changed

+14
-40
lines changed

4 files changed

+14
-40
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ permissions:
1414

1515
jobs:
1616
set-version:
17+
name: Set Version
1718
runs-on: ubuntu-latest
1819
container:
1920
image: mcr.microsoft.com/dotnet/sdk:10.0
@@ -44,6 +45,7 @@ jobs:
4445
4546
test:
4647
runs-on: ubuntu-latest
48+
name: Run Tests
4749
needs: set-version
4850
env:
4951
SEMVER: ${{ needs.set-version.outputs.semVer }}

.github/workflows/release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ permissions:
1414

1515
jobs:
1616
set-version:
17+
name: Set Version
1718
runs-on: ubuntu-latest
1819
if: ${{ github.event.workflow_run.head_branch == 'master' && github.event.workflow_run.conclusion == 'success' }}
1920
container:
@@ -39,6 +40,7 @@ jobs:
3940
id: gitversion
4041

4142
release:
43+
name: Release
4244
runs-on: ubuntu-latest
4345
needs: set-version
4446
env:

internal/lexer/lexer.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,12 @@ var nonText = map[string]bool{
1717
// this forces the lexer to not treat at as TEXT
1818
// and enter the switch statement of the state machine
1919
// NOTE: when a new implementation is added we should add it here
20-
// AWS|AZure...
20+
// AWS|AZure|GCP...
2121
"A": true,
2222
// VAULT (HashiCorp)
2323
"V": true,
2424
// GCP
2525
"G": true,
26-
// // Unknown
27-
// "U": true,
2826
}
2927

3028
type Source struct {
@@ -211,7 +209,7 @@ func (l *Lexer) setTextSeparatorToken() config.Token {
211209
return tok
212210
}
213211

214-
// peekIsBeginOfToken attempts to identify the gendoc keyword after 2 slashes
212+
// peekIsBeginOfToken attempts to identify the possible token
215213
func (l *Lexer) peekIsBeginOfToken(possibleBeginToken []config.ImplementationPrefix, charsRead string) (bool, string, config.ImplementationPrefix) {
216214
for _, pbt := range possibleBeginToken {
217215
configToken := ""
@@ -229,11 +227,6 @@ func (l *Lexer) peekIsBeginOfToken(possibleBeginToken []config.ImplementationPre
229227
return false, "", ""
230228
}
231229

232-
// peekIsEndOfToken
233-
func (l *Lexer) peekIsEndOfToken() bool {
234-
return false
235-
}
236-
237230
// resetAfterPeek will go back specified amount on the cursor
238231
func (l *Lexer) resetAfterPeek(back int) {
239232
l.position = l.position - back

internal/strategy/strategy.go

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
// Package strategy is a strategy pattern wrapper around the store implementations
2-
//
3-
// NOTE: this may be refactored out into the store package directly
1+
// Package strategy is a factory method wrapper around the backing store implementations
42
package strategy
53

64
import (
@@ -53,20 +51,17 @@ type strategyFnMap struct {
5351
funcMap StrategyFuncMap
5452
}
5553

56-
type RetrieveStrategy struct {
57-
// mu *sync.Mutex
58-
implementation store.Strategy
54+
type Strategy struct {
5955
config config.GenVarsConfig
6056
strategyFuncMap strategyFnMap
6157
}
6258

63-
type Opts func(*RetrieveStrategy)
59+
type Opts func(*Strategy)
6460

6561
// New
66-
func New(config config.GenVarsConfig, logger log.ILogger, opts ...Opts) *RetrieveStrategy {
67-
rs := &RetrieveStrategy{
68-
config: config,
69-
// mu: &sync.Mutex{},
62+
func New(config config.GenVarsConfig, logger log.ILogger, opts ...Opts) *Strategy {
63+
rs := &Strategy{
64+
config: config,
7065
strategyFuncMap: strategyFnMap{mu: sync.Mutex{}, funcMap: defaultStrategyFuncMap(logger)},
7166
}
7267
// overwrite or add any options/defaults set above
@@ -82,7 +77,7 @@ func New(config config.GenVarsConfig, logger log.ILogger, opts ...Opts) *Retriev
8277
// Mainly used for testing
8378
// NOTE: this may lead to eventual optional configurations by users
8479
func WithStrategyFuncMap(funcMap StrategyFuncMap) Opts {
85-
return func(rs *RetrieveStrategy) {
80+
return func(rs *Strategy) {
8681
rs.strategyFuncMap.mu.Lock()
8782
defer rs.strategyFuncMap.mu.Unlock()
8883
for prefix, implementation := range funcMap {
@@ -93,7 +88,7 @@ func WithStrategyFuncMap(funcMap StrategyFuncMap) Opts {
9388

9489
// GetImplementation is a factory method returning the concrete implementation for the retrieval of the token value
9590
// i.e. facilitating the exchange of the supplied token for the underlying value
96-
func (rs *RetrieveStrategy) GetImplementation(ctx context.Context, token *config.ParsedTokenConfig) (store.Strategy, error) {
91+
func (rs *Strategy) GetImplementation(ctx context.Context, token *config.ParsedTokenConfig) (store.Strategy, error) {
9792
if token == nil {
9893
return nil, fmt.Errorf("unable to get prefix, %w", ErrTokenInvalid)
9994
}
@@ -114,24 +109,6 @@ func ExchangeToken(s store.Strategy, token *config.ParsedTokenConfig) *TokenResp
114109
return cr
115110
}
116111

117-
// func (rs *RetrieveStrategy) setImplementation(strategy store.Strategy) {
118-
// rs.mu.Lock()
119-
// defer rs.mu.Unlock()
120-
// rs.implementation = strategy
121-
// }
122-
123-
// func (rs *RetrieveStrategy) setTokenVal(s *config.ParsedTokenConfig) {
124-
// rs.mu.Lock()
125-
// defer rs.mu.Unlock()
126-
// rs.implementation.SetToken(s)
127-
// }
128-
129-
// func (rs *RetrieveStrategy) getTokenValue() (string, error) {
130-
// rs.mu.Lock()
131-
// defer rs.mu.Unlock()
132-
// return rs.implementation.Token()
133-
// }
134-
135112
type TokenResponse struct {
136113
value string
137114
key *config.ParsedTokenConfig

0 commit comments

Comments
 (0)