9
9
"io"
10
10
"net/url"
11
11
"os"
12
- "path/filepath"
13
12
"strings"
14
13
"time"
15
14
@@ -28,7 +27,7 @@ func init() {
28
27
Examples:
29
28
Before running any of these, first use src auth to authenticate.
30
29
Alternately, use the SRC_ACCESS_TOKEN environment variable for
31
- individual src-cli invocations.
30
+ individual src-cli invocations.
32
31
33
32
If run from within the project itself, src-cli will infer various
34
33
flags based on git metadata.
@@ -48,9 +47,6 @@ Examples:
48
47
49
48
$ src code-intel upload -github-token=BAZ, or
50
49
$ src code-intel upload -gitlab-token=BAZ
51
-
52
- For any of these commands, an LSIF index (default name: dump.lsif) can be
53
- used instead of a SCIP index (default name: index.scip).
54
50
`
55
51
codeintelCommands = append (codeintelCommands , & command {
56
52
flagSet : codeintelUploadFlagSet ,
@@ -61,24 +57,13 @@ Examples:
61
57
fmt .Println (usage )
62
58
},
63
59
})
64
-
65
- // Make 'upload' available under 'src lsif' for backwards compatibility.
66
- lsifCommands = append (lsifCommands , & command {
67
- flagSet : codeintelUploadFlagSet ,
68
- handler : handleCodeIntelUpload ,
69
- usageFunc : func () {
70
- fmt .Fprintf (flag .CommandLine .Output (), "Usage of 'src lsif %s':\n " , codeintelUploadFlagSet .Name ())
71
- codeintelUploadFlagSet .PrintDefaults ()
72
- fmt .Println (usage )
73
- },
74
- })
75
60
}
76
61
77
62
// handleCodeIntelUpload is the handler for `src code-intel upload`.
78
63
func handleCodeIntelUpload (args []string ) error {
79
64
ctx := context .Background ()
80
65
81
- out , isSCIPAvailable , err := parseAndValidateCodeIntelUploadFlags (args )
66
+ out , err := parseAndValidateCodeIntelUploadFlags (args )
82
67
if ! codeintelUploadFlags .json {
83
68
if out != nil {
84
69
printInferredArguments (out )
@@ -96,7 +81,7 @@ func handleCodeIntelUpload(args []string) error {
96
81
Flags : codeintelUploadFlags .apiFlags ,
97
82
})
98
83
99
- uploadOptions := codeintelUploadOptions (out , isSCIPAvailable )
84
+ uploadOptions := codeintelUploadOptions (out )
100
85
uploadID , err := upload .UploadIndex (ctx , codeintelUploadFlags .file , client , uploadOptions )
101
86
if err != nil {
102
87
return handleUploadError (uploadOptions .SourcegraphInstanceOptions .AccessToken , err )
@@ -141,18 +126,13 @@ func handleCodeIntelUpload(args []string) error {
141
126
}
142
127
143
128
// codeintelUploadOptions creates a set of upload options given the values in the flags.
144
- func codeintelUploadOptions (out * output.Output , isSCIPAvailable bool ) upload.UploadOptions {
129
+ func codeintelUploadOptions (out * output.Output ) upload.UploadOptions {
145
130
var associatedIndexID * int
146
131
if codeintelUploadFlags .associatedIndexID != - 1 {
147
132
associatedIndexID = & codeintelUploadFlags .associatedIndexID
148
133
}
149
134
150
- cfg .AdditionalHeaders ["Content-Type" ] = "application/x-ndjson+lsif"
151
- path := codeintelUploadFlags .uploadRoute
152
- if isSCIPAvailable && filepath .Ext (codeintelUploadFlags .file ) == ".scip" {
153
- cfg .AdditionalHeaders ["Content-Type" ] = "application/x-protobuf+scip"
154
- path = strings .ReplaceAll (path , "lsif" , "scip" )
155
- }
135
+ cfg .AdditionalHeaders ["Content-Type" ] = "application/x-protobuf+scip"
156
136
157
137
logger := upload .NewRequestLogger (
158
138
os .Stdout ,
@@ -178,7 +158,7 @@ func codeintelUploadOptions(out *output.Output, isSCIPAvailable bool) upload.Upl
178
158
AdditionalHeaders : cfg .AdditionalHeaders ,
179
159
MaxRetries : 5 ,
180
160
RetryInterval : time .Second ,
181
- Path : path ,
161
+ Path : codeintelUploadFlags . uploadRoute ,
182
162
MaxPayloadSizeBytes : codeintelUploadFlags .maxPayloadSizeMb * 1000 * 1000 ,
183
163
MaxConcurrency : codeintelUploadFlags .maxConcurrency ,
184
164
GitHubToken : codeintelUploadFlags .gitHubToken ,
@@ -263,7 +243,7 @@ func attachHintsForAuthorizationError(accessToken string, originalError error) e
263
243
264
244
if likelyTokenError {
265
245
return errorWithHint {err : originalError , hint : strings .Join (mergeStringSlices (
266
- []string {"A Sourcegraph access token must be provided via SRC_ACCESS_TOKEN for uploading SCIP/LSIF data." },
246
+ []string {"A Sourcegraph access token must be provided via SRC_ACCESS_TOKEN for uploading SCIP data." },
267
247
actionableHints ,
268
248
[]string {"For more details, see https://sourcegraph.com/docs/cli/how-tos/creating_an_access_token." },
269
249
), "\n " )}
@@ -304,7 +284,7 @@ func attachHintsForAuthorizationError(accessToken string, originalError error) e
304
284
}
305
285
306
286
return errorWithHint {err : originalError , hint : strings .Join (mergeStringSlices (
307
- []string {"This Sourcegraph instance has enforced auth for SCIP/LSIF uploads." },
287
+ []string {"This Sourcegraph instance has enforced auth for SCIP uploads." },
308
288
actionableHints ,
309
289
[]string {"For more details, see https://docs.sourcegraph.com/cli/references/code-intel/upload." },
310
290
), "\n " )}
0 commit comments