mirror of
https://github.com/hanzoai/commerce.git
synced 2026-10-30 15:08:42 +00:00
Multi-tenant commerce and billing: orders, subscriptions, invoices, plans, usage metering and a credit ledger. One Go binary. MIT OR Apache-2.0. Claude-Session: https://claude.ai/code/session_01SAtaDFm8VDiWrhYHNNtxMw
32 lines
472 B
Go
32 lines
472 B
Go
package fs
|
|
|
|
import (
|
|
"io/ioutil"
|
|
"log"
|
|
"strings"
|
|
)
|
|
|
|
func ReadFile(path string) []byte {
|
|
dat, err := ioutil.ReadFile(path)
|
|
if err != nil {
|
|
log.Fatalln(err)
|
|
}
|
|
|
|
return dat
|
|
}
|
|
|
|
func SplitLines(s string) []string {
|
|
return strings.Split(s, "\n")
|
|
}
|
|
|
|
func ReadLines(path string) []string {
|
|
return SplitLines(string(ReadFile(path)))
|
|
}
|
|
|
|
func WriteFile(path string, data string) {
|
|
err := ioutil.WriteFile(path, []byte(data), 0644)
|
|
if err != nil {
|
|
log.Fatalln(err)
|
|
}
|
|
}
|