Go-flavor

Go Flavor for Structure 101


Project maintained by bunniesandbeatings Hosted on GitHub Pages — Theme by mattgraham

Structure 101 Golang flavor

This is a Golang flavor for the Structure 101 static analysis and architectural decision making tool.

Note: If you're wondering where the code for the runner lives, it's here.

Why?

I used Structure 101 in the past, on Actionscript and Java projects. It was fantastic, really helped me recognize flaws in my dependency tree. Many people miss the value of a well structured, cycle-free dependency tree. For me, it's central to producing code that is easy to reason about.

For many years, I've been primarily a Ruby developer. Unfortunately, Ruby's dynamicism does not lend itself well to static analysis, and I've aborted my attempt to produce a Ruby flavor for Structure 101.

I'm also developing in Go more and more, not so much by choice but because it fits the needs of products I work with. So despite my misgivings about the expressiveness of Go, I still want to have great tools for working with it. This Structure 101 flavor is one of them.

Currently

Not much here yet. A simple flavor you have to download, build the binary dependency for, and put in your struct101g folder. It only reads package level dependencies from your app at the moment.

Plans

  1. Runner binaries for osx, linux and windows
  2. Tests! Currently this code is a Spike. I'm a TDD guy, but with severe limitations on my time and weak Golang skills, I'm just hacking to prove value. I want to throw my code out and rewrite it with tests driving out the design.
  3. CI, probably on CircleCI.
  4. Node types:
    1. Package (Done!)
      1. Constant
      2. Variable
      3. Function
    2. Type (struct/interface)
      1. Public field
      2. Function
  5. Dependency types:
    1. Import (Done!)
    2. Variable/Const type definition
    3. Field type Definition
    4. Parameter type definition
    5. Return type definition
    6. Function calls
    7. Casts

Installation

Currently this is only tested on OSX. It should work on any *nix with a bash shell.

  1. Install go and make sure your GOPATH is set up
  2. Download and build

    git clone https://github.com/bunniesandbeatings/go-flavor
    cd go-flavor
    ./scripts/build
  3. Symlink into Struct101g (if you cant find the struct101g folder, run struct101g first and install one of the other flavors)

    ln -s `pwd` $HOME/structure101g/flavors/com.bunniesandbeatings.go-flavor_0.0.1
  4. You must restart Structure 101g, it should have a new Project type under 'New Project' for the Go flavor.

Usage

  1. In Structure 101g, create a new project
  2. Select the "com.bunniesandbeatings.go-flavor" project type
  3. click Next
  4. For '$GOPATH', enter your gopath. Unfortunately Structure 101g doesn't run the flavor's runner using your shell environment.
  5. For 'Package Definition', use a package ref as described by go help packages
    1. For example github.com/bunniesandbeatings/go-flavor-parser/...

Project backlog

Maintained on the go-flavor Pivotal Tracker project