Skip to content

Instantly share code, notes, and snippets.

@podhmo
podhmo / README.md
Last active September 20, 2025 12:51
goscanのScannerのcallgraphを作りたいと言ったらcopilotがなんか生成してきた

CPU プロファイル解析レポート

概要

  • 実行ファイル: find-orphans
  • プロファイル時間: 2025-09-20 03:17:20 JST
  • 実行時間: 19.76秒
  • 総サンプル時間: 50.16秒 (253.88% - 複数コアを使用)

主要なボトルネック

@podhmo
podhmo / README.md
Last active September 20, 2025 13:17
go-scanのコードを真面目に読んで理解する

問題

  • そもそもsymgoで--mode libを指定したときに遅いのと失敗している。
  • ⚠️ そもそもメモ化効いてなくない?
@podhmo
podhmo / README.md
Last active September 18, 2025 14:48
コントロールを手放すとか会議の内部と外部とか
@podhmo
podhmo / README.md
Last active September 14, 2025 04:38
直近のこと

対話履歴

ユーザー:

AIへの指示:思考整理とタスク洗い出しサポート のプロンプト詳細

【指示】 あなたは、ユーザーの思考を整理し、頭の中に隠れているタスクやアイデアを洗い出すためのAIアシスタントです。 ユーザーが頭の中にある曖昧な考えや課題、感情などを、具体的な言葉にして外部に列挙するプロセスを支援してください。

@podhmo
podhmo / README.md
Last active September 13, 2025 14:00

再現方法は go-scanリポジトリで make -C examples/find-orphans

エラーログのグルーピング (全79行)

グループ1: 未解決の関数の間接参照エラー (計52回)

stringsfmtencoding/jsonstrconv パッケージ内の型や関数が解決できないままポインタとして参照しようとしたため、大量のエラーが発生しています。

  • エラーメッセージ: invalid indirect of <Unresolved Function: ...> (type *object.UnresolvedFunction)
  • 発生箇所:
This file has been truncated, but you can view the full file.
time=2025-09-11T19:12:54.901+09:00 level=ERROR msg="unsupported assignment target: expected an identifier, selector or index expression, but got *ast.StarExpr" in_func=Assign in_func_pos=$HOME/ghq/github.com/podhmo/go-scan/minigo/evaluator/evaluator.go:2972:8 exec_pos=$HOME/ghq/github.com/podhmo/go-scan/symgo/evaluator/evaluator.go:2628 pos=1353171
time=2025-09-11T19:12:54.902+09:00 level=ERROR msg="unsupported assignment target: expected an identifier, selector or index expression, but got *ast.StarExpr" in_func=Assign in_func_pos=$HOME/ghq/github.com/podhmo/go-scan/minigo/evaluator/evaluator.go:2972:8 exec_pos=$HOME/ghq/github.com/podhmo/go-scan/symgo/evaluator/evaluator.go:2628 pos=1353171
time=2025-09-11T19:12:54.906+09:00 level=ERROR msg="unsupported assignment target: expected an identifier, selector or index expression, but got *ast.StarExpr" in_func=Assign in_func_pos=$HOME/ghq/github.com/podhmo/go-scan/minigo/evaluator/evaluator.go:2972:8 exec_pos=$HOME/ghq/github.com/podhmo/go-scan/symgo/evaluator/e
This file has been truncated, but you can view the full file.
time=2025-09-11T19:08:21.405+09:00 level=DEBUG source=$HOME/ghq/github.com/podhmo/go-scan/examples/find-orphans/main.go:109 msg="no go.work file found, falling back to go.mod scan" root=$HOME/ghq/github.com/podhmo/go-scan
time=2025-09-11T19:08:21.410+09:00 level=DEBUG source=$HOME/ghq/github.com/podhmo/go-scan/examples/find-orphans/main.go:175 msg="creating locators for workspace" count=9 modules="[$HOME/ghq/github.com/podhmo/go-scan/examples/convert $HOME/ghq/github.com/podhmo/go-scan/examples/convert-define $HOME/ghq/github.com/podhmo/go-scan/examples/deriving-all $HOME/ghq/github.com/podhmo/go-scan/examples/derivingbind $HOME/ghq/github.com/podhmo/go-scan/examples/derivingjson $HOME/ghq/github.com/podhmo/go-scan/examples/docgen $HOME/ghq/github.com/podhmo/go-scan/examples/minigo $HOME/ghq/github.com/podhmo/go-scan $HOME/ghq/github.com/podhmo/go-scan/integration_test]"
time=2025-09-11T19:08:21.466+09:00 level=INFO source=$HOME/ghq/github.com/podhmo/go-scan/examples/find-orphans/main.go:197 msg="* scan modul
@podhmo
podhmo / README.md
Created September 7, 2025 13:57
メモリー消費が爆発するのを防ぎたい

Of course. Here is a GitHub Actions workflow that achieves your specific goal.

This solution avoids using benchmark functions and instead uses go test -memprofile directly on your integration tests. It then processes the resulting profile file to extract the total memory usage and posts a concise, easy-to-read summary as a comment on the Pull Request.

This workflow also includes the requested concurrency setting to automatically cancel outdated checks when new commits are pushed to the same PR.

Complete GitHub Actions Workflow

You can create a new file at .github/workflows/memory-profiling.yml and paste the following content.

@podhmo
podhmo / PERFORMANCE_OPTIMIZATION.md
Last active September 7, 2025 11:55
何とは言わないけれど、goでひどいコードになっていた。気づいたらたかだか18000行くらいのコードの解析に75GBとかメモリーを使っていた。最終的に14.8MBになった。

Performance Optimization Report for symgo/integration_test

Executive Summary

The integration tests are experiencing significant performance issues, taking ~7 seconds to complete with extreme memory usage (75GB+). This document outlines the identified bottlenecks and proposed optimizations.

Performance Analysis

Test Execution Time

  • Total Duration: ~7 seconds