Latest Threat ResearchGlassWorm Loader Hits Open VSX via Developer Account Compromise.Details
Socket
Book a DemoInstallSign in
Socket

vimagination.zapto.org/gotypes

Package Overview
Dependencies
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vimagination.zapto.org/gotypes

Go Modules
Version
v1.2.1
Version published
Created
Source

gotypes

CI Go Reference Go Report Card

-- import "vimagination.zapto.org/gotypes"

Package gotypes provides a helper function to parse Go types from source code.

Highlights

  • Simple parsing of Go source code to enable reading of type information.
  • Automatically handles dependencies, using local cache, stdlib, and remote Go mod proxy.
  • Optionally omit specific source code files from parsing.
  • Helper funcs to simplify common tasks.

Usage

package main

import (
	"fmt"
	"go/types"

	"vimagination.zapto.org/gotypes"
)

func main() {
	pkg, err := gotypes.ParsePackage(".")
	if err != nil {
		fmt.Println(err)

		return
	}

	z := pkg.Scope().Lookup("zipFS")
	fmt.Println(z)

	for field := range z.Type().Underlying().(*types.Struct).Fields() {
		fmt.Println(field)
	}

	// Output:
	// type vimagination.zapto.org/gotypes.zipFS struct{*archive/zip.Reader; base string}
	// field Reader *archive/zip.Reader
	// field base string
}

Documentation

Full API docs can be found at:

https://pkg.go.dev/vimagination.zapto.org/gotypes

FAQs

Package last updated on 02 Feb 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts