Code Monkey home page Code Monkey logo

go-deprecated's Introduction

Go Deprecated Experiment

A simple Go module to determine when deprecated functions are explicitly tagged as DEPRECATED on pkg.go.dev.

Motivation

go-libp2p has some functions that are explicitly marked as deprecated via a newline followed by a line starting with // Deprecated:. E.g.,

// EnableAutoRelay configures libp2p to enable the AutoRelay subsystem.
// ...
//
// Deprecated: Use EnableAutoRelayWithStaticRelays or EnableAutoRelayWithPeerSource
func EnableAutoRelay(opts ...autorelay.Option) Option {
    // implementation here…
}

pkg.go.dev tags these function as DEPRECATED.

But there are other functions that are marked as deprecated in the source code but are not tagged as DEPRECATED on pkg.go.dev. E.g.,

// DialRanker configures libp2p to use d as the dial ranker. To enable smart
// dialing use `swarm.DefaultDialRanker`. use `swarm.NoDelayDialRanker` to
// disable smart dialing.
// Deprecated: use SwarmOpts(swarm.WithDialRanker(d)) instead
func DialRanker(d network.DialRanker) Option {
    // implementation here…
}

In this case, the function is not tagged as DEPRECATED, despite the // Deprecated: comment in the source code.

Hypothesis

I think pkg.go.dev requires a newline before "// Deprecated:".

Testing

This is a simple Go module that should appear on pkg.go.dev. It includes a few functions.

  • One isn't deprecated at all (used as a control)
  • One is deprecated with a newline before the // Deprecated: line
  • One is deprecated without a newline before the // Deprecated: line

I want to see what functions are actually tagged as deprecated by pkg.go.dev.

If my hypothesis is true, I'll make a PR to fix the deprecated comments in go-libp2p.

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.