Skip to content

Commit

Permalink
compatibilidade com <go1.16 adicionada
Browse files Browse the repository at this point in the history
as funções "os.ReadFile" "os.WriteFile" [são idênticas](golang/go#42026) as funções "ioutil.ReadFile" e "ioutil.WriteFile" do "[io/ioutil](https://docs.studygolang.com/pkg/io/ioutil/)"
  • Loading branch information
HackerGaucho committed Nov 15, 2021
1 parent a3fa4d0 commit 4959588
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"encoding/json"
"net/http"
"os"
"io/ioutil"
"text/template"
"time"
)
Expand All @@ -17,11 +17,11 @@ var Messages []Message

func saveMessages() {
m, _ := json.Marshal(Messages)
os.WriteFile("data.txt", m, 0644)
ioutil.WriteFile("data.txt", m, 0644)
}

func loadMessages() {
data, _ := os.ReadFile("data.txt")
data, _ := ioutil.ReadFile("data.txt")
json.Unmarshal(data, &Messages)
}

Expand Down

0 comments on commit 4959588

Please sign in to comment.