Пример #1
0
func debugImportDebug(files []string) error {
	if len(files) == 0 {
		fmt.Println("need argument: files...")
		return errNoValue
	}

files:
	for _, filename := range files {
		data, err := ioutil.ReadFile(filename)
		if err != nil {
			fmt.Println(err)
			os.Exit(1)
		}

		var debuginfo debugexport.DebugResponse
		err = json.Unmarshal(data, &debuginfo)
		if err != nil {
			fmt.Printf("could not decode %s: %s \n", filename, err.Error())
			os.Exit(1)
		}
		if debuginfo.Encrypted != "" {
			err := debuginfo.Decrypt(debugPublicKey, debugSecretKey)
			if err != nil {
				lg.Errorf("%s could not be decrypted, skipping: %v", filename, err)
				continue files
			}
		}
		debuginfo.WriteToDisk()
	}
	return nil
}
Пример #2
0
func debugImportDebug(files []string) error {
	if len(files) == 0 {
		fmt.Println("need argument: files...")
		return errNoValue
	}
	for _, filename := range files {
		data, err := ioutil.ReadFile(filename)
		if err != nil {
			fmt.Println(err)
			os.Exit(1)
		}
		var debuginfo debugexport.DebugResponse
		err = json.Unmarshal(data, &debuginfo)
		if err != nil {
			fmt.Printf("could not decode %s: %s \n", filename, err.Error())
			os.Exit(1)
		}
		debuginfo.WriteToDisk()
	}
	return nil
}