Git Product home page Git Product logo

modlist's Introduction

modlist

modlist command lists your go modules/packages.

How it works

modlist loads go.work and list Go modules. And load module names from each go.mod files of modules.

If --packages option is enabled, list all packages from your modules instead of module name. It uses go list command

Usage

$ cat go.work
go 1.20

use (
        .
        ./module1
        ./module2
)
$ tree .
.
├── go.mod
├── go.work
├── module1
│   ├── go.mod
│   ├── package1
│   │   └── source.go
│   ├── package2
│   │   └── source.go
│   └── source.go
├── module2
│   ├── go.mod
│   ├── internal
│   │   └── pkg
│   │       └── source.go
│   └── source.go
├── package1
│   └── source.go
├── package2
│   └── source.go
└── source.go

9 directories, 12 files

List your modules.

$ modlist
example.com/multi
example.com/multi/module1
example.com/multi/module2

List your packages.

$ modlist --packages
example.com/multi
example.com/multi/module1
example.com/multi/module1/package1
example.com/multi/module1/package2
example.com/multi/module2
example.com/multi/module2/internal/pkg
example.com/multi/package1
example.com/multi/package2

Test your all packages and get coverages without internal package.

$ go test -coverpkg=`modlist -p -e="*internal*" --separator=","` `modlist -p -s`
ok      example.com/multi/module2       0.115s  coverage: [no statements]
ok      example.com/multi/package1      0.221s  coverage: [no statements]
ok      example.com/multi/module1/package2      0.325s  coverage: [no statements]
ok      example.com/multi       0.429s  coverage: [no statements]
ok      example.com/multi/module1       0.815s  coverage: [no statements]
ok      example.com/multi/module2/internal/pkg  0.928s  coverage: [no statements]
ok      example.com/multi/package2      1.333s  coverage: [no statements]
ok      example.com/multi/module1/package1      1.446s  coverage: [no statements]

Options

option shorthand default description
--packages -p false List all packages instead of modules
--shuffle -s false Shuffle output
--match -m Exclude unmatch items
--exclude -e Exclude match items
--separator "\n" Output separator
--directory -d false Show module/package paths instead of their names
--golangci-lint-skip-dirs false If configuration file of golangci-lint exists, read run.skip-dirs and run.skip-dirs-use-default option

modlist's People

Contributors

daichitakahashi avatar

Watchers

 avatar

modlist's Issues

Basic impl

  • list workspace
  • list all packages
  • option: -prefix, -suffix (or support template)
  • option: shuffle
  • option: exclude(using *)
  • option: include(also using *)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.