// SetImportedPkg adds imported packages to AnalyzerConfig. It does not handle CONST, TYPE and VAR.
SetImportedPkg adds imported packages to AnalyzerConfig. It does not handle CONST, TYPE and VAR.
// SetImportedPkg adds imported packages to AnalyzerConfig . It does not handle CONST TYPE and VAR .
func SetImportedPkg(genDecl *ast.GenDecl, cfg *AnalyzerConfig) error {
	if genDecl.Tok != token.IMPORT {
		return nil
	}
	for _, spec := range genDecl.Specs {
		importSpec, ok := spec.(*ast.ImportSpec)
		if !ok {
			return nil
		}
		name, err := strconv.Unquote(importSpec.Path.Value)
		if err != nil {
			return fmt.Errorf("strconv.Unquote -> %w", err)
		}
		cfg.ImportedPkgs = append(cfg.ImportedPkgs, name)
	}
	return nil
}
func SetImportedPkg ( genDecl * ast . GenDecl , cfg * AnalyzerConfig ) error { if genDecl . Tok != token . IMPORT { return nil } for _ , spec := range genDecl . Specs { importSpec , ok := spec . ( * ast . ImportSpec ) if ! ok { return nil } name , err := strconv . Unquote ( importSpec . Path . Value ) if err != nil { return fmt . Errorf ( " " , err ) } cfg . ImportedPkgs = append ( cfg . ImportedPkgs , name ) } return nil }
SetImportedPkg adds imported packages to AnalyzerConfig.
SetImportedPkg adds imported packages to AnalyzerConfig .