File tree Expand file tree Collapse file tree 1 file changed +16
-11
lines changed Expand file tree Collapse file tree 1 file changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -221,6 +221,21 @@ func checkVendor() bool {
221
221
return true
222
222
}
223
223
224
+ func getSourceDir () string {
225
+ srcdir := os .Getenv ("LGTM_SRC" )
226
+ if srcdir != "" {
227
+ log .Printf ("LGTM_SRC is %s\n " , srcdir )
228
+ } else {
229
+ cwd , err := os .Getwd ()
230
+ if err != nil {
231
+ log .Fatalln ("Failed to get current working directory." )
232
+ }
233
+ log .Printf ("LGTM_SRC is not set; defaulting to current working directory %s\n " , cwd )
234
+ srcdir = cwd
235
+ }
236
+ return srcdir
237
+ }
238
+
224
239
func getDepMode () DependencyInstallerMode {
225
240
if util .FileExists ("go.mod" ) {
226
241
log .Println ("Found go.mod, enabling go modules" )
@@ -349,17 +364,7 @@ func main() {
349
364
350
365
log .Printf ("Autobuilder was built with %s, environment has %s\n " , runtime .Version (), getEnvGoVersion ())
351
366
352
- srcdir := os .Getenv ("LGTM_SRC" )
353
- if srcdir != "" {
354
- log .Printf ("LGTM_SRC is %s\n " , srcdir )
355
- } else {
356
- cwd , err := os .Getwd ()
357
- if err != nil {
358
- log .Fatalln ("Failed to get current working directory." )
359
- }
360
- log .Printf ("LGTM_SRC is not set; defaulting to current working directory %s\n " , cwd )
361
- srcdir = cwd
362
- }
367
+ srcdir := getSourceDir ()
363
368
364
369
// we set `SEMMLE_PATH_TRANSFORMER` ourselves in some cases, so blank it out first for consistency
365
370
os .Setenv ("SEMMLE_PATH_TRANSFORMER" , "" )
You can’t perform that action at this time.
0 commit comments