1234567891011121314151617181920212223242526 |
- package pb
- import (
- "fmt"
- "io/ioutil"
- "strings"
- "testing"
- )
- const filename = "./roleUser.pb.go"
- func TestRemoveTag(t *testing.T) {
- fileData, err := ioutil.ReadFile(filename)
- if err != nil {
- fmt.Printf("ReadFile err: %v\n", err)
- return
- }
- data := strings.ReplaceAll(string(fileData), ",omitempty", "")
- fileData = []byte(data)
- err = ioutil.WriteFile(filename, fileData, 0644)
- if err != nil {
- fmt.Printf("WriteFile err: %v\n", err)
- return
- }
- fmt.Println("TestRemoveTag successfully")
- }
|