Skip to content

Commit 81fbf54

Browse files
author
Montana Flynn
committed
Add back the time package and refactor timeout
1 parent e553ca1 commit 81fbf54

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/targets/go/native.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
var util = require('util');
44

55
module.exports = function (source, options) {
6+
67
// Let's Go!
78
var code = [];
89

@@ -28,6 +29,10 @@ module.exports = function (source, options) {
2829
code.push('import (');
2930
code.push('\t"fmt"');
3031

32+
if (opts.timeout > 0) {
33+
code.push('\t"time"');
34+
}
35+
3136
if (source.postData.text) {
3237
code.push('\t"strings"');
3338
}
@@ -45,7 +50,7 @@ module.exports = function (source, options) {
4550
// Create client
4651
if (opts.timeout > 0) {
4752
code.push('\tclient := http.Client{');
48-
code.push('\t\tTimeout: time.Duration(' + opts.timeout + ' * time.Second),');
53+
code.push(util.format('\t\tTimeout: time.Duration(%s * time.Second),', opts.timeout));
4954
code.push('\t}');
5055
} else {
5156
code.push('\tclient := &http.Client{}');

0 commit comments

Comments
 (0)