fossas / fossas/fossa-action

Cannot analyze Go 1.21 module with `toolchain` directive

Open
#33 0 comments 3 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
73
Forks
21
Avg merge
1d 21h
Merged PRs (30d)
4

Description

### Problem statement

Recently we've introduced the `toolchain` keyword (as described in: https://go.dev/blog/toolchain) in our Go project https://github.com/Kong/kubernetes-ingress-controller/commit/4422d519b3912f524cacb93aec6c973ab0e51b86 and since then our [fossa scans yield](https://github.com/Kong/kubernetes-ingress-controller/actions/runs/6104722910/job/16567157127#step:3:88):

```
An issue occurred

>>> Relevant errors

Error

Command execution failed:

Attempted to run the command 'go list -e -json -deps all'
inside the working directory '/home/runner/work/kubernetes-ingress-controller/kubernetes-ingress-controller/',
but failed, because the command exited with code '1'.

Often, this kind of error is caused by the project not being ready to build;
please ensure that the project at '/home/runner/work/kubernetes-ingress-controller/kubernetes-ingress-controller/'
builds successfully before running fossa.

The logs for the command are listed below.
They will likely provide guidance on how to resolve this error.
Command did not write a standard log.

Command error log:
go: errors parsing go.mod:
/home/runner/work/kubernetes-ingress-controller/kubernetes-ingress-controller/go.mod:5: unknown directive: toolchain

If you believe this to be a defect, please report a bug to FOSSA support at https://support.fossa.com/

Traceback:
- Running command 'go'
- Getting dependencies using 'go list -e -json -deps all'
- analysis using go list (V3 Resolver)
- Dynamic analysis
- Gomodules
- Project Analysis: GomodProjectType

Error

Error parsing file: /home/runner/work/kubernetes-ingress-controller/kubernetes-ingress-controller/go.mod.

/home/runner/work/kubernetes-ingress-controller/kubernetes-ingress-controller/go.mod:5:1:
|
5 | toolchain go1.21.0
| ^
unexpected 't'
expecting "exclude", "go", "replace", "require", "retract", or end of input

If you believe this to be a defect, please report a bug to FOSSA support at https://support.fossa.com/, with a copy of:
/home/runner/work/kubernetes-ingress-controller/kubernetes-ingress-controller/go.mod

Traceback:
- Parsing file '/home/runner/work/kubernetes-ingress-controller/kubernetes-ingress-controller/go.mod'
- Static analysis
- Gomodules
- Project Analysis: GomodProjectType
```

Manually running `fossa` locally passes:

```
FOSSA_API_KEY=XXXXXXXXXXXXXXXXXXXX ./fossa analyze .
Analyzing gomod project at /Users/X/code_/kubernetes-ingress-controller/
Skipping gomod project at "/Users/X/code_/kubernetes-ingress-controller/third_party/" (default non-production path filtering)
NOTE: /Users/X/code_/kubernetes-ingress-controller/ analyzed using V3 Go Resolver.
As of v3.8.5 we have changed our dynamic Go strategy. If you've analyzed this project before, results may have changed.
See https://github.com/fossas/fossa-cli/blob/master/docs/references/strategies/languages/golang/v3-go-resolver-transition-qa.md for more information.

Scan Summary
------------
fossa-cli version 3.8.11 (revision b8973c30f5cf compiled with ghc-9.0)
fossa endpoint server version: 4.14.18

2 projects scanned; 1 skipped, 1 succeeded, 0 failed, 0 analysis warnings

* gomod project in "/Users/X/code_/kubernetes-ingress-controller/": succeeded
* gomod project in "/Users/X/code_/kubernetes-ingress-controller/third_party/": skipped (non-production path filtering)
-

Some projects may not appear in the summary if they were filtered during discovery.
You can run `fossa list-targets` to see all discoverable projects.

You can pass `--debug` option to eagerly show all warning and failure messages.
You can also view analysis summary with warning and error messages at: "/private/var/folders/0m/_63w01516tgf3cftmp9h7ylm0000gn/T/fossa-analyze-scan-summary.txt"
------------

Using project name: `git@github.com:Kong/kubernetes-ingress-controller.git`
Using revision: `d781042d455b82e079194728d72c4d451f9422d6`
Using branch: `main`
============================================================

View FOSSA Report:
https://app.fossa.com/projects/custom%XXXXXXXXXX%2fgit%40github.com:Kong%2fkubernetes-ingress-controller.git/refs/branch/main/XXXXXXXXXXXXXXXXXXXXXXXXXXXX

============================================================

```

### Expected behavior

Fossa scans work for projects using Go's 1.21 `toolchain` directive.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.