godoc without showing source code - go

I got several Go projects which is documented compatibly with godoc. We use godoc to share doc and code internally as a doc server without significant problem. However we need more control on opening code when we want to share doc with 3rd party. Is there a way to run godoc in a special mode that showing types and docs but never link to or showing source code?
I've tried
godoc -http=0.0.0.0:8090 -links=false -src=false
but not working, still can link to type definition code. Just wondering if missed sth. Go version, 1.3.

The src file only refers to command line mode, not to server mode, so it won't help you. The way I see it there are a few options:
Rewrite godoc for your needs and use your own fork.
Don't use the server mode, render the docs in command line mode and just create a server out of that.
Better yet (I'm not entirely sure 2 will work) - rewrite the templates a bit so the source code won't be linked. But you'll still need to make sure people who enter the path manually won't see the code so it will require fudging the source templates as well. or...
Maybe the simplest thing - run it behind nginx or a similar reverse proxy, and make sure the /src path in the server is closed to outside visitors, or password protected or whatever. That way your internal team can still use it.
Personally I'd go with 4, it's a couple minutes of work and will be the most robust and flexible solution.

Related

vscode: How to search in installed package?

I want to search in the go pkg go-git.
ctrl+shift+f searches only in my module.
Probably this will not directly answer, but it's an workaround, that I personally prefer:
Hovering over a function, that is from a foreign package, VS Code shows the godoc description. There is always a link to pkg.go.dev (This link is for the PlainClone example):
Following it you are redirected directly to GO's package website.
Here is already a nice list with the module's functions.
if you want to dive deeper:
On the top of the repository there is the link to the repo host.
Experiences show, that this is mostly Github. While GitHub's search used to be proscribed, it can nowadays be a mightful tool:
https://docs.github.com/en/search-github/searching-on-github/searching-code#search-within-a-users-or-organizations-repositories
Again I mention that is very subjective, but GO's complex way of storing modules locally with it's many env variables and stuff made me feel using the internet is more comfortable =)

How to run pkg.go.dev locally as a godoc replacement?

godoc has been removed from the go standard install since 1.12 and looks like it wont be updated anytime soon. pkg.go.dev at least appears to be its successor. It also has additional documentation features like grabbing the README.md file and rendering it in the documentation page.
For these reasons I was hoping to switch over to using pkg.go.dev locally to view and create documentation for small internal packages. The major issue is that unlike godoc there does not seem to be a clear usage guide. I also do not know if pkpg.go.dev is completely overkill for this task. So I would like to know:
Can and should pkg.go.dev be used as a local godoc replacement?
If yes, how would I run it for this task?
Run pkgsite locally.
go install golang.org/x/pkgsite/cmd/pkgsite#latest && pkgsite
References:
https://tip.golang.org/doc/comment
https://pkg.go.dev/golang.org/x/pkgsite/cmd/pkgsite
You can use the x/tools/godoc that has the previous godoc tool
Running godoc [1] on its own worked for me, but was really slow because it generates docs for every single package in the standard library, while I only care about the local package that I am working on. To that end, if your package is in a folder called something, you can move the folder so that it looks like this:
godoc/src/something
Then, go to the godoc folder, and run
godoc -goroot .
Then, browse to localhost:6060. Alternatively, another site is available for
Go docs [2].
https://github.com/golang/tools/tree/master/cmd/godoc
https://godocs.io

Firefox Addon SDK1.17 Annotator tutorial: widget/button does not appear

I am trying to work through https://developer.mozilla.org/en-US/Add-ons/SDK/Tutorials/Annotator with jpm (https://developer.mozilla.org/en-US/Add-ons/SDK/Tools/jpm) rather than cfx, and running into difficulties:=> the button/widget that the addon adds does not appear in my browser. Not even in the Additional Tools and Features section if I go to Customize the browswer appearance.
This is the SDK v1.17, and Firefox v38.0.1 for Linux (openSuSE13.2).
I have created the structure and files with given names and contents, telling jpm to use main.js as the entry point, rather than index.js, in order to match the tutorial (which is cfx-based).
I am also passing jpm the -b PATH-TO-FIREFOX-BINARY flag, because it apparently doesn't follow the symlink at /usr/bin/firefox, but it sounds like that's a known issue.
I am also also passing jpm the -p MY-DEV-PROFILE flag because I found that with the introductory tutorial (https://developer.mozilla.org/en-US/Add-ons/SDK/Tutorials/Getting_Started_%28jpm%29) that was the only way I could get that button to show up.
But that doesn't help here, nor does leaving off that option.
The Addon Manager confirms that the extension is installed.
So I am open to suggestions. Obviously I am new to extension development, and pretty new to javascript in general.
I had also better ask while I am here: What I want to do is modify the behaviour of Firefox's Find (in page); can something like that be done with the SDK, or do I need to use the Overlay method?
Any other suggestions helpful for learning addon development would also be welcome (but should probably be done as comments, rather than Answers; let's save Answers for the original question about this tutorial button).
Thanks!
The widget api was removed in Firefox 38. For most cases you can replace widget with the button apis we introduced in Firefox 29, see this blog post for more information.
Ah, heheh, never mind.
It was just an impedence mismatch between the original cfx instructions and the jpm way of doing things.
While I had told jpm to use main.js instead of index.js, I had failed to tell it that main.js was in the "./lib/" directory instead of the root directory of the extension.
After changing the package.json to say
"main": "./lib/main.js"
it works - as far as that goes. But it turns out that the entire tutorial is no longer valid; see my (Edward's) comment on canuckistani's answer.
My subsidiary questions about whether the SDK will even do what I want (changing some Find behaviour) and any other advice/resources still stand, however.

Running Umbraco source code in Windows 7 only produces login screen

I am trying to get started in development of my website and plugins using Umbraco. When I download the binaries from Codeplex, the installation and running of the website works fine. When I downloaded the source code, All I get is a login screen even when the web.config files are the same. Am I doing something wrong or is there something I missed.
The path I use to map IIS to is
branches\4.1.0\umbraco\presentation
You need to compile the source code to get it to work.
To be honest, you shouldn't need the full source unless you really want to start hacking around in the core (which may cause you problems with future updates) or you want to see how stuff works. The Umbraco framework is pretty extensible, I've not found too much so far that I couldn't do without having to touch the core source.
I had a similar issue when running the source and that was that the hashing of the admin password did not work. So i debugged it to see what value was expected and then changed it in the database.

What "Pastie" alternatives are there? (installable)

I want to install a "pastie" in our local intranet. What are the alternatives to RaPaste and pastie.org? (the latter can't even be installed locally b/c it doesn't seem to be open source?)
Edit: Doesn't have to be Ruby btw.
Edit: What I mean with pastie is an app where you can share source code pastes instead of pasting it in an irc chat.
There is for instance LodgeIt by the Pocoo guys.
Your request isn't very clear. Starting by defining what are "pasties" in your mind might help (I knew pasties from deviantART, which are very different beasts...). I had to go to the indicated sites to have an idea.
It isn't clear either if it must be Ruby only or not (I see only a tag, no clear requirement).
I know the old and reputed pastebin.org, its (PHP) source is available.

Resources