WithName defines ProjectOptions' name
(name string)
| 105 | |
| 106 | // WithName defines ProjectOptions' name |
| 107 | func WithName(name string) ProjectOptionsFn { |
| 108 | return func(o *ProjectOptions) error { |
| 109 | // a project (once loaded) cannot have an empty name |
| 110 | // however, on the options object, the name is optional: if unset, |
| 111 | // a name will be inferred by the loader, so it's legal to set the |
| 112 | // name to an empty string here |
| 113 | if name != loader.NormalizeProjectName(name) { |
| 114 | return loader.InvalidProjectNameErr(name) |
| 115 | } |
| 116 | o.Name = name |
| 117 | return nil |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | // WithWorkingDirectory defines ProjectOptions' working directory |
| 122 | func WithWorkingDirectory(wd string) ProjectOptionsFn { |
searching dependent graphs…