Patching with comments

オープン
#41 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

@Shubham-Padkonde がすでに取り組んでいます。

2026年9月27日 から。

  • #49 @Shubham-Padkonde による — オープン

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
go
領域
tooling

調査の方向性

Value.Patch エントリーポイントから開始し、2 つの patch の例を比較して、挿入された値の周囲のコメントがどのように処理されるかを追跡します。patch 対象のオブジェクトの外側にあるコメントを保持できるかどうかを判断し、その結果得られるポリシーが要求された人間が読みやすいコメントを保持することを検証します。

索引モデルが issue の本文から書いたものです。

説明

Hey all- we're updating our tailnet config to have a posture/ grant per production device on our network, since we have a load of devices, and we don't want to manage this by hand, and because we want to use time-based/ device-based access.

It's working very nicely (loving the Value.Patch() function).

Is there anyway of patching in comments, too, outside of the patched in object? We still want people to be able to hand read/ review the policy, and being able to add comments would help that a lot.

If I set my patch like:

	err = v.Patch([]byte(`[
{"op": "add", "path": "/grants/0", "value":{
"src": ["autogroup:member"],
// My super duper device
"dst": ["ipset:super_duper_device"],
"srcPosture": ["posture:super_duper_device_TemporaryFullAccess"]}}
]`))
	if err != nil {
		panic(err)
	}

Then sure enough, I see:

        "grants": [                                                                                                                                                                           
                {                                                                                                                                                                             
                        "src": ["autogroup:member"],                                                                                                                                          
                        // My super duper device                                                                                                                                                   
                        "dst":        ["ipset:super_duper_device"],                                
                        "srcPosture": ["posture:super_duper_device_TemporaryFullAccess"],                                                                                                         
                },                                                                        

But if I move the comment outside of the block as per:

	err = v.Patch([]byte(`[
{"op": "add", "path": "/grants/0", "value":
// My super duper device
{
"src": ["autogroup:member"],
"dst": ["ipset:super_duper_device"],
"srcPosture": ["posture:super_duper_device_TemporaryFullAccess"]}}
]`))
	if err != nil {
		panic(err)
	}

Then the comment isn't persisted:

        "grants": [                                                                                                                                                                           
                {                                                                                                                                                                             
                        "src":        ["autogroup:member"],                                                                                                                                          
                        "dst":        ["ipset:super_duper_device"],                                
                        "srcPosture": ["posture:super_duper_device_TemporaryFullAccess"],                                                                                                         
                },                                                                        
主要言語
Go
スター
892
フォーク
40
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

tailscale/hujson のほかの issue

tailscale/hujson の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。