You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A library that exposes scanning capabilities for Snyk Code that can be used in the [Snyk CLI](https://github.com/snyk/cli) as well as Snyk IDE plugins using the [Snyk Language Server](https://github.com/snyk/snyk-ls).
4
+
5
+
## Installation
6
+
7
+
```shell script
8
+
$ go get github.com/snyk/code-client-go
9
+
```
10
+
11
+
## Usage
12
+
13
+
### HTTP Client
14
+
15
+
Use the HTTP client to make HTTP requests with configured retriable codes and authorisation headers for Snyk Rest APIs.
The Bundle Manager exposes the following functions:
49
+
-`Create`
50
+
-`Upload`
51
+
52
+
### Code Scanner
53
+
54
+
Use the Code Scanner to trigger a scan for a Snyk Code workspace using the Bundle Manager created above:
55
+
56
+
```go
57
+
codeScanner:= codeclient.NewCodeScanner(
58
+
bundleManager,
59
+
testutil.NewTestInstrumentor(),
60
+
testutil.NewTestCodeInstrumentor(),
61
+
testutils.NewTestAnalytics(),
62
+
)
63
+
```
64
+
65
+
The Code Scanner exposes a `UploadAndAnalyze` function.
66
+
67
+
### Observability
68
+
69
+
Under [./observability](./observability) we have defined some observability interfaces which allows consumers of the library to inject their own observability implementations as long as they follow the defined interfaces.
log.Trace().Str("path", filePath).Int("size", len(fileContent)).Msgf("added to deepCodeBundle #%v", len(batches))
204
+
b.logger.Trace().Str("path", filePath).Int("size", len(fileContent)).Msgf("added to deepCodeBundle #%v", len(batches))
197
205
batch.documents[filePath] =file
198
206
} else {
199
-
log.Trace().Str("path", filePath).Int("size", len(fileContent)).Msgf("created new deepCodeBundle - %v bundles in this upload so far", len(batches))
207
+
b.logger.Trace().Str("path", filePath).Int("size", len(fileContent)).Msgf("created new deepCodeBundle - %v bundles in this upload so far", len(batches))
0 commit comments