aboutsummaryrefslogtreecommitdiff
path: root/lib/compilers/golang.ts
diff options
context:
space:
mode:
authorJeremy Rifkin <51220084+jeremy-rifkin@users.noreply.github.com>2023-01-29 13:22:30 -0500
committerGitHub <noreply@github.com>2023-01-29 13:22:30 -0500
commit6a6efaefe650c06fd93e0d52e0ae6b6e3b4d4718 (patch)
treeffeb8626d237499e91babfd329cb752497b19872 /lib/compilers/golang.ts
parent87203f71cb1294703dcdbcb4abc3385b21083291 (diff)
downloadcompiler-explorer-6a6efaefe650c06fd93e0d52e0ae6b6e3b4d4718.tar.gz
compiler-explorer-6a6efaefe650c06fd93e0d52e0ae6b6e3b4d4718.zip
Tsify lib/compilers (#4609)gh-6026
Diffstat (limited to 'lib/compilers/golang.ts')
-rw-r--r--lib/compilers/golang.ts13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/compilers/golang.ts b/lib/compilers/golang.ts
index b1de66884..7db2d87e2 100644
--- a/lib/compilers/golang.ts
+++ b/lib/compilers/golang.ts
@@ -24,7 +24,10 @@
import _ from 'underscore';
+import {CompilerInfo} from '../../types/compiler.interfaces';
+import {ParseFiltersAndOutputOptions} from '../../types/features/filters.interfaces';
import {ResultLine} from '../../types/resultline/resultline.interfaces';
+import {unwrap} from '../assert';
import {BaseCompiler} from '../base-compiler';
import * as utils from '../utils';
@@ -55,7 +58,7 @@ export class GolangCompiler extends BaseCompiler {
return 'golang';
}
- constructor(compilerInfo, env) {
+ constructor(compilerInfo: CompilerInfo, env) {
super(compilerInfo, env);
const goroot = this.compilerProps<string | undefined>(`compiler.${this.compiler.id}.goroot`);
const goarch = this.compilerProps<string | undefined>(`compiler.${this.compiler.id}.goarch`);
@@ -219,21 +222,21 @@ export class GolangCompiler extends BaseCompiler {
return [];
}
- override optionsForFilter(filters, outputFilename, userOptions) {
+ override optionsForFilter(filters: ParseFiltersAndOutputOptions, outputFilename: string, userOptions?: string[]) {
// If we're dealing with an older version...
if (this.compiler.id === '6g141') {
return ['tool', '6g', '-g', '-o', outputFilename, '-S'];
}
if (filters.binary) {
- return ['build', '-o', outputFilename, '-gcflags=' + userOptions.join(' ')];
+ return ['build', '-o', outputFilename, '-gcflags=' + unwrap(userOptions).join(' ')];
} else {
// Add userOptions to -gcflags to preserve previous behavior.
- return ['build', '-o', outputFilename, '-gcflags=-S ' + userOptions.join(' ')];
+ return ['build', '-o', outputFilename, '-gcflags=-S ' + unwrap(userOptions).join(' ')];
}
}
- override filterUserOptions(userOptions) {
+ override filterUserOptions(userOptions: string[]) {
if (this.compiler.id === '6g141') {
return userOptions;
}