原型的無效解組
php小編魚仔為您介紹「原型的無效解組」。在軟體開發中,原型是一個重要的概念,用於快速驗證和展示設計想法。然而,有時原型被認為是無效的,因為它可能沒有達到預期的目標或無法滿足使用者需求。在這種情況下,我們需要對原型進行無效解組,找出問題所在,並尋找解決方案。本文將探討原型無效解組的重要性以及如何有效地進行解組工作。
問題內容
我正在嘗試解碼原始資料。但原型未正確解碼。
這就是我正在做的事情:
decodedstr, err := base64.stdencoding.decodestring(request.body) if err != nil { panic("malformed input") } data := &tracepb.exporttraceservicerequest{} if err := proto.unmarshal(decodedstr, data); err != nil { log.fatalln("failed to parse:", err) } log.printf("response - %v", data)
登入後複製
輸出如下:
response - resource_spans:{resource:{attributes:{key:"service.name" value:{string_value:"node_app"}} attributes:{key:"telemetry.sdk.language" value:{string_value:"nodejs"}} attributes:{key:"telemetry.sdk.name" value:{string_value:"opentelemetry"}} attributes:{key:"telemetry.sdk.version" value:{string_value:"1.8.0"}} attributes:{key:"process.pid" value:{int_value:1}} attributes:{key:"process.executable.name" value:{string_value:"node"}} attributes:{key:"process.command" value:{string_value:"/usr/app/index.js"}} attributes:{key:"process.command_line" value:{string_value:"/usr/local/bin/node /usr/app/index.js"}} attributes:{key:"process.runtime.version" value:{string_value:"18.13.0"}} attributes:{key:"process.runtime.name" value:{string_value:"nodejs"}} attributes:{key:"process.runtime.description" value:{string_value:"node.js"}}} scope_spans:{scope:{name:"@opentelemetry/instrumentation-express" version:"0.32.0"} spans:{trace_id:"\xb5\x81\x91\x8b\x02\x9a/\xf1\x08\x06\xaf~\xea\x9fq\xc0" span_id:"t\x06\x89m\x1ex\xf9a" parent_span_id:"?\xbc\x18`o\xa5\xb8\xe1" name:"middleware - query" kind:span_kind_internal start_time_unix_nano:1673434036590614272 end_time_unix_nano:1673434036590671104 attributes:{key:"http.route" value:{string_value:"/"}} attributes:{key:"express.name" value:{string_value:"query"}} attributes:{key:"express.type" value:{string_value:"middleware"}} status:{}} spans:{trace_id:"\xb5\x81\x91\x8b\x02\x9a/\xf1\x08\x06\xaf~\xea\x9fq\xc0" span_id:"\xd5c\xf7>\xf6cxz" parent_span_id:"?\xbc\x18`o\xa5\xb8\xe1" name:"middleware - expressinit" kind:span_kind_internal start_time_unix_nano:1673434036590760704
登入後複製
不知道為什麼traceid會這樣顯示:
spans:{trace_id:"\xb5\x81\x91\x8b\x02\x9a/\xf1\x08\x06\xaf~\xea\x9fQ\xc0"
登入後複製
我是 go 語言新手。任何幫助將不勝感激
解決方法
使用encoding/hex
模組的hex.EncodeToString()
函數將bytes
轉換為hex
以上是原型的無效解組的詳細內容。更多資訊請關注PHP中文網其他相關文章!
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

AI Hentai Generator
免費產生 AI 無盡。

熱門文章
R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
2 週前
By 尊渡假赌尊渡假赌尊渡假赌
倉庫:如何復興隊友
4 週前
By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island冒險:如何獲得巨型種子
3 週前
By 尊渡假赌尊渡假赌尊渡假赌
擊敗分裂小說需要多長時間?
3 週前
By DDD
R.E.P.O.保存文件位置:在哪里以及如何保護它?
3 週前
By DDD

熱工具

記事本++7.3.1
好用且免費的程式碼編輯器

SublimeText3漢化版
中文版,非常好用

禪工作室 13.0.1
強大的PHP整合開發環境

Dreamweaver CS6
視覺化網頁開發工具

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)