tilaklodha / google-authenticator

94 stars 31 forks source link

As of Go 1.16 package ioutil is deprecated, replace with package os #4

Open Ellwould opened 2 years ago

Ellwould commented 2 years ago

Original Code:

func main() { //Read the secret token from file system data, err := ioutil.ReadFile("dummy_secret.pem") check(err) secret := string(data) otp := getTOTPToken(secret)


New Code:

func main() { //Read the secret token from file system data, err := os.ReadFile("dummy_secret.pem") check(err) secret := string(data) otp := getTOTPToken(secret)

OR

func main() { //Read the secret token from file system secret, err := os.ReadFile("dummy_secret.pem") check(err) otp := getTOTPToken(string(secret))


import package os and remove package io/ioutil


Source: https://pkg.go.dev/io/ioutil@go1.19.3