godoctor

command module
v0.0.0-...-168c4d1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2026 License: BSD-3-Clause Imports: 4 Imported by: 1

README

The Go Doctor

⚠️ Deprecated — this project is no longer actively maintained.

gopls — the official Go language server maintained by the Go team — has superseded the Go Doctor. It provides equivalent (and more) refactoring functionality and is actively developed. New users should use gopls; existing users are encouraged to migrate.

The source remains available here for historical reference. The previous project website at gorefactor.org is being retired. The user manual and install guide are now hosted via GitHub Pages: https://godoctor.github.io/godoctor/

GoDoc Project Status

A golang refactoring tool

                                 .,;;::;;;;::;,.                    
                           .'.......         ......'.               
                  .'.'. .,,'......        .''...''. .,;:'.''.       
                ':;,..::..,'.   ..',     ,.       .,.  ';...,c.     
              ',ccdXXx. .; .       .:   c.,c;       l    dXXklc,,.  
            .:;cc .:O.  ;,0XO,      ;.  l;X0d;      c.   .kl'::,;:' 
           .l,, ''.:'   ,:kOc'      ;.  ,:lo;.     .:     'l'.  .;;'
           ;,;    'c     ;,       .;''clc:;'.    .,.       :     ;.;
           ;,;    :,      ........:',kKXKx';:.....         :.    ;.;
           .c,'   l'              :    .    :.             ;.   .;',
            ,;;.  l.              .',.,:.',.'              ;;   ;,: 
             .;;, l.                ; .: .;                ,: ';;,  
              .';:c:                ..',.'.                ;l,:'.   
                 .,c:,.                                 .';c;'      
                   c',c:,'                           .',c,,cc       
         .'....'.  ;   .';c;...                  ..,c:'..  .l       
        ,' .''. ,. :       ''::''.           .'';c,'.      .o       
        ;  :  : .l.c.         ..';ll.......:l:'...         .x'',,   
        .:..''..c,.l.             ;;.     .,:               d;.cl.  
          ....:cc..c                .''.''.                 l,..    
              .c;' :                  lc;                   c'      
               .:;l:                  l:,                   c,      
                 ;::.                 l:,                   :,      
                  :c;'                l:'                   :,      
                  ,o;;,.             ;;;                    c'      
                  '; ';:,'.        ';::                     l.      
                   :   ..;c:,'.',;c;'.                     .l       
                   :       .......                         ;.       
                   ':                                     ;,        
                    ,;                                   :'         
                     .;.                               .l.          
                     .,:''.                        .','..,,         
                    :;'  .:l,''''............''''''..,. .;:,        
                    'c;.''       ............         .'.,.         
                      ,:.                                           

Installation

git clone https://github.com/godoctor/godoctor
cd godoctor && go install

For vim users see https://github.com/godoctor/godoctor.vim

Usage

It's recommended to use godoctor with an editor, though godoctor can be used directly.

$ godoctor

The godoctor command without any arguments provides usage information. For full documentation, see:

$ godoctor -doc

Documentation

Overview

The godoctor command refactors Go code.

Directories

Path Synopsis
analysis
cfg
Package cfg provides intraprocedural control flow graphs (CFGs) with statement-level granularity, i.e., CFGs whose nodes correspond 1-1 to the Stmt nodes from an abstract syntax tree.
Package cfg provides intraprocedural control flow graphs (CFGs) with statement-level granularity, i.e., CFGs whose nodes correspond 1-1 to the Stmt nodes from an abstract syntax tree.
dataflow
Package dataflow provides data flow analyses that can be performed on a previously constructed control flow graph, including a reaching definitions analysis and a live variables analysis for local variables.
Package dataflow provides data flow analyses that can be performed on a previously constructed control flow graph, including a reaching definitions analysis and a live variables analysis for local variables.
loader
Package loader wraps golang.org/x/tools/go/packages with utility types and methods
Package loader wraps golang.org/x/tools/go/packages with utility types and methods
names
Package names provides functions to analyze the usage names (functions, types, variables, etc.) across multiple files.
Package names provides functions to analyze the usage names (functions, types, variables, etc.) across multiple files.
Package doc contains functions to generate the HTML User's Guide and the man page for the Go Doctor.
Package doc contains functions to generate the HTML User's Guide and the man page for the Go Doctor.
Package engine is the programmatic entrypoint to the Go refactoring engine.
Package engine is the programmatic entrypoint to the Go refactoring engine.
cli
The cli package provides a command-line interface for the Go Doctor.
The cli package provides a command-line interface for the Go Doctor.
protocol
Package protocol provides an implementation of the OpenRefactory protocol (server-side), which provides a standard mechanism for text editors to communicate with refactoring engines.
Package protocol provides an implementation of the OpenRefactory protocol (server-side), which provides a standard mechanism for text editors to communicate with refactoring engines.
Package filesystem provides a file system abstraction and types describing potential changes to a file system.
Package filesystem provides a file system abstraction and types describing potential changes to a file system.
hack
gensite command
Command gensite generates the static documentation site that GitHub Pages serves from the /docs directory.
Command gensite generates the static documentation site that GitHub Pages serves from the /docs directory.
Package refactoring contains all of the refactorings supported by the Go Doctor, as well as types (such as refactoring.Log) used to interface with those refactorings.
Package refactoring contains all of the refactorings supported by the Go Doctor, as well as types (such as refactoring.Log) used to interface with those refactorings.
Package text provides the text manipulation infrastructure used for refactoring, including the definition of EditSet (a set of changes to be made to a text file) and functions for creating unified diffs.
Package text provides the text manipulation infrastructure used for refactoring, including the definition of EditSet (a set of changes to be made to a text file) and functions for creating unified diffs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL