mirror of
https://github.com/go-i2p/newsgo.git
synced 2025-07-12 19:04:40 -04:00
remove accidentally commited debug code. fix ioutil deprecations
This commit is contained in:
12
cmd/build.go
12
cmd/build.go
@ -1,9 +1,6 @@
|
|||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -24,13 +21,6 @@ var buildCmd = &cobra.Command{
|
|||||||
// For some reason this is the only way passing booleans from cobra to viper works
|
// For some reason this is the only way passing booleans from cobra to viper works
|
||||||
viper.GetViper().Set("i2p", i2p)
|
viper.GetViper().Set("i2p", i2p)
|
||||||
|
|
||||||
viper.WriteConfigTo(os.Stdout)
|
|
||||||
viper.Unmarshal(c)
|
|
||||||
data, _ := json.MarshalIndent(&c, " ", "")
|
|
||||||
fmt.Print(string(data[:]))
|
|
||||||
|
|
||||||
os.Exit(0)
|
|
||||||
|
|
||||||
f, e := os.Stat(c.NewsFile)
|
f, e := os.Stat(c.NewsFile)
|
||||||
if e != nil {
|
if e != nil {
|
||||||
panic(e)
|
panic(e)
|
||||||
@ -113,7 +103,7 @@ func build(newsFile string) {
|
|||||||
if err := os.MkdirAll(filepath.Join(c.BuildDir, filepath.Dir(filename)), 0755); err != nil {
|
if err := os.MkdirAll(filepath.Join(c.BuildDir, filepath.Dir(filename)), 0755); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
if err = ioutil.WriteFile(filepath.Join(c.BuildDir, filename), []byte(feed), 0644); err != nil {
|
if err = os.WriteFile(filepath.Join(c.BuildDir, filename), []byte(feed), 0644); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ import (
|
|||||||
"crypto/rsa"
|
"crypto/rsa"
|
||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
"encoding/pem"
|
"encoding/pem"
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -59,7 +58,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func loadPrivateKey(path string) (*rsa.PrivateKey, error) {
|
func loadPrivateKey(path string) (*rsa.PrivateKey, error) {
|
||||||
privPem, err := ioutil.ReadFile(path)
|
privPem, err := os.ReadFile(path)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user