Support go 1.13
This commit is contained in:
parent
c7805b4bbd
commit
a034e52a6e
3
main.go
3
main.go
|
@ -7,6 +7,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"html"
|
"html"
|
||||||
"io"
|
"io"
|
||||||
|
"io/ioutil"
|
||||||
"mime/multipart"
|
"mime/multipart"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
@ -29,7 +30,7 @@ func handleMessage(client *http.Client, botToken string, message *Message) error
|
||||||
if len(split) == 2 {
|
if len(split) == 2 {
|
||||||
command.Stdin = strings.NewReader(split[1])
|
command.Stdin = strings.NewReader(split[1])
|
||||||
}
|
}
|
||||||
stdout, err := os.CreateTemp("", "ridi*")
|
stdout, err := ioutil.TempFile("", "ridi*")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to create temporary file: %s", err)
|
return fmt.Errorf("failed to create temporary file: %s", err)
|
||||||
}
|
}
|
||||||
|
|
4
utils.go
4
utils.go
|
@ -3,13 +3,13 @@ package main
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
func parseBody(resp *http.Response) (json.RawMessage, error) {
|
func parseBody(resp *http.Response) (json.RawMessage, error) {
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
bytes, err := io.ReadAll(resp.Body)
|
bytes, err := ioutil.ReadAll(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to read response body: %s", err)
|
return nil, fmt.Errorf("failed to read response body: %s", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue