Giter Site home page Giter Site logo

clientgofix's Introduction

clientgofix is a tool for adjusting k8s.io/client-go invocations for k8s.io/client-go v0.18.0+ versions. It can be run on a codebase before or after updating the k8s.io/client-go dependency.

See https://git.k8s.io/enhancements/keps/sig-api-machinery/20200123-client-go-ctx.md for more context.

โš ๏ธ This tool is under active development and rewrites source files in place by default. It is strongly recommended to run this on a version-controlled source tree with all unrelated work committed.

Automatic adjustments:

  • Inserts a context.TODO() argument where required
  • Inserts an empty options struct argument where required (like metav1.UpdateOptions{})
  • Dereferences existing *metav1.DeleteOptions arguments
  • Replaces existing nil *metav1.DeleteOptions arguments with metav1.DeleteOptions{}
  • Adds context and metav1 imports where required (deconflicting with existing import and declaration names)

Manual adjustments required:

  • Context parameters passed to rest.Request#Context must be manually moved to the request Do() invocation.

To install:

git clone https://github.com/kubernetes-sigs/clientgofix.git
cd clientgofix
make install

To use:

cd /path/to/project
clientgofix ./pkg/to/fix

Options:

  • Multiple packages or a recursive package spec can be provided:

    • clientgofix ./pkg1 ./pkg2
    • clientgofix ./...
  • Files are rewritten in place by default. Set -overwrite=false to write to peer tmp files.

  • If errors are encountered processing a file, writing is skipped by default. Set -write-on-error=true to write the file even when errors are encountered.

clientgofix's People

Contributors

liggitt avatar k8s-ci-robot avatar

Watchers

 avatar

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.