getOptions sets the options from flags passed in.
(ctx context.Context)
| 51 | |
| 52 | // getOptions sets the options from flags passed in. |
| 53 | func getOptions(ctx context.Context) (opt []transform, err error) { |
| 54 | if !Transforming(ctx) { |
| 55 | return opt, nil |
| 56 | } |
| 57 | |
| 58 | ci := fs.GetConfig(ctx) |
| 59 | |
| 60 | // return cached opt if available |
| 61 | if cachedNameTransform != nil && slices.Equal(ci.NameTransform, cachedNameTransform) { |
| 62 | return cachedOpt, nil |
| 63 | } |
| 64 | |
| 65 | for _, transform := range ci.NameTransform { |
| 66 | t, err := parse(transform) |
| 67 | if err != nil { |
| 68 | return opt, err |
| 69 | } |
| 70 | opt = append(opt, t) |
| 71 | } |
| 72 | updateCache(ci.NameTransform, opt) |
| 73 | return opt, nil |
| 74 | } |
| 75 | |
| 76 | func updateCache(nt []string, o []transform) { |
| 77 | cacheLock.Lock() |
no test coverage detected
searching dependent graphs…