Slide 1

Slide 1 text

Achievement in Merpay Expert Team Masahiro Matsui (@Matts966)

Slide 2

Slide 2 text

Table Of Contents - Motivation - What is static analysis? - analysisutil - refsafe - genelizer - misc

Slide 3

Slide 3 text

Motivation Find problems in programs in the earlier phaze

Slide 4

Slide 4 text

Static Analysis is analysis of computer software that is performed without actually executing programs. @tenntenn さんの『ソースコードを堪能せよ 』より引用

Slide 5

Slide 5 text

analysisutil Does all the path pass through X from start to goal? start goal X

Slide 6

Slide 6 text

examples in reflect

Slide 7

Slide 7 text

refsafe A linter to use reflect package more securely by - Check the order of function calls - and their return value

Slide 8

Slide 8 text

genelizer - Motivation - abstract the static analysis procedures - write linter rules declaratively - A tool to generate linters that check the order of functions & method call - HCL2 syntax

Slide 9

Slide 9 text

genelizer Analyzer Analyzer Analyzer Analyzer Executable binary rule rule rule BuildSSA

Slide 10

Slide 10 text

For what we can use genelizer? - Check complex order of function calls - e.g. in payment services - Linter for errors package (Go 1.13) - Check if resources are used correctly - e.g. files, memory, http.Response.Body… - and other types which implement Closer interface

Slide 11

Slide 11 text

packr's problem - This code works - This code doesn’t

Slide 12

Slide 12 text

misc - Add a validation to consul - Send a patch to go vet (passes/printf) These are not completed or merged. Breaking changes or causing trade-off can lead to ignored PR. So I wrote only an issue in the case of packr and will discuss desirable solution.

Slide 13

Slide 13 text

Thanks Any question?