├── .gitignore ├── Dockerfile ├── Gopkg.lock ├── Gopkg.toml ├── LICENSE ├── README.md ├── event.go ├── event_test.go ├── k8s ├── deployment.yml ├── namespace.yml ├── rbac.yml ├── secrets.yml └── service.yml ├── main.go ├── main_test.go ├── merge.go ├── merge_test.go ├── processors ├── interfaces.go ├── issues_event.go ├── issues_event_test.go ├── mainline_status_event.go ├── mainline_status_event_test.go ├── merge.go ├── processors_test.go ├── pull_request_review.go ├── push_event.go ├── push_event_test.go ├── rebase.go ├── rebase_test.go ├── status_event.go ├── status_event_test.go └── types.go ├── repo ├── cache.go ├── cache_test.go ├── internal │ ├── cmd │ │ └── cmd.go │ └── log │ │ └── log.go ├── rebaser.go ├── signal.go ├── worker.go └── worker_test.go ├── scenarios └── rebase-conflict.zip ├── startup.sh ├── vendor ├── github.com │ ├── golang │ │ └── protobuf │ │ │ ├── .gitignore │ │ │ ├── .travis.yml │ │ │ ├── AUTHORS │ │ │ ├── CONTRIBUTORS │ │ │ ├── LICENSE │ │ │ ├── Make.protobuf │ │ │ ├── Makefile │ │ │ ├── README.md │ │ │ ├── _conformance │ │ │ ├── Makefile │ │ │ ├── conformance.go │ │ │ └── conformance_proto │ │ │ │ ├── conformance.pb.go │ │ │ │ └── conformance.proto │ │ │ ├── descriptor │ │ │ ├── descriptor.go │ │ │ └── descriptor_test.go │ │ │ ├── jsonpb │ │ │ ├── jsonpb.go │ │ │ ├── jsonpb_test.go │ │ │ └── jsonpb_test_proto │ │ │ │ ├── Makefile │ │ │ │ ├── more_test_objects.pb.go │ │ │ │ ├── more_test_objects.proto │ │ │ │ ├── test_objects.pb.go │ │ │ │ └── test_objects.proto │ │ │ ├── proto │ │ │ ├── Makefile │ │ │ ├── all_test.go │ │ │ ├── any_test.go │ │ │ ├── clone.go │ │ │ ├── clone_test.go │ │ │ ├── decode.go │ │ │ ├── decode_test.go │ │ │ ├── encode.go │ │ │ ├── encode_test.go │ │ │ ├── equal.go │ │ │ ├── equal_test.go │ │ │ ├── extensions.go │ │ │ ├── extensions_test.go │ │ │ ├── lib.go │ │ │ ├── map_test.go │ │ │ ├── message_set.go │ │ │ ├── message_set_test.go │ │ │ ├── pointer_reflect.go │ │ │ ├── pointer_unsafe.go │ │ │ ├── properties.go │ │ │ ├── proto3_proto │ │ │ │ ├── proto3.pb.go │ │ │ │ └── proto3.proto │ │ │ ├── proto3_test.go │ │ │ ├── size2_test.go │ │ │ ├── size_test.go │ │ │ ├── testdata │ │ │ │ ├── Makefile │ │ │ │ ├── golden_test.go │ │ │ │ ├── test.pb.go │ │ │ │ └── test.proto │ │ │ ├── text.go │ │ │ ├── text_parser.go │ │ │ ├── text_parser_test.go │ │ │ └── text_test.go │ │ │ ├── protoc-gen-go │ │ │ ├── Makefile │ │ │ ├── descriptor │ │ │ │ ├── Makefile │ │ │ │ └── descriptor.pb.go │ │ │ ├── doc.go │ │ │ ├── generator │ │ │ │ ├── Makefile │ │ │ │ ├── generator.go │ │ │ │ └── name_test.go │ │ │ ├── grpc │ │ │ │ └── grpc.go │ │ │ ├── link_grpc.go │ │ │ ├── main.go │ │ │ ├── plugin │ │ │ │ ├── Makefile │ │ │ │ ├── plugin.pb.go │ │ │ │ └── plugin.pb.golden │ │ │ └── testdata │ │ │ │ ├── Makefile │ │ │ │ ├── extension_base.proto │ │ │ │ ├── extension_extra.proto │ │ │ │ ├── extension_test.go │ │ │ │ ├── extension_user.proto │ │ │ │ ├── grpc.proto │ │ │ │ ├── imp.pb.go.golden │ │ │ │ ├── imp.proto │ │ │ │ ├── imp2.proto │ │ │ │ ├── imp3.proto │ │ │ │ ├── main_test.go │ │ │ │ ├── multi │ │ │ │ ├── multi1.proto │ │ │ │ ├── multi2.proto │ │ │ │ └── multi3.proto │ │ │ │ ├── my_test │ │ │ │ ├── test.pb.go │ │ │ │ ├── test.pb.go.golden │ │ │ │ └── test.proto │ │ │ │ └── proto3.proto │ │ │ └── ptypes │ │ │ ├── any.go │ │ │ ├── any │ │ │ ├── any.pb.go │ │ │ └── any.proto │ │ │ ├── any_test.go │ │ │ ├── doc.go │ │ │ ├── duration.go │ │ │ ├── duration │ │ │ ├── duration.pb.go │ │ │ └── duration.proto │ │ │ ├── duration_test.go │ │ │ ├── empty │ │ │ ├── empty.pb.go │ │ │ └── empty.proto │ │ │ ├── regen.sh │ │ │ ├── struct │ │ │ ├── struct.pb.go │ │ │ └── struct.proto │ │ │ ├── timestamp.go │ │ │ ├── timestamp │ │ │ ├── timestamp.pb.go │ │ │ └── timestamp.proto │ │ │ ├── timestamp_test.go │ │ │ └── wrappers │ │ │ ├── wrappers.pb.go │ │ │ └── wrappers.proto │ └── google │ │ ├── go-github │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── AUTHORS │ │ ├── CONTRIBUTING.md │ │ ├── LICENSE │ │ ├── README.md │ │ ├── examples │ │ │ └── basicauth │ │ │ │ └── main.go │ │ ├── github │ │ │ ├── activity.go │ │ │ ├── activity_events.go │ │ │ ├── activity_events_test.go │ │ │ ├── activity_notifications.go │ │ │ ├── activity_notifications_test.go │ │ │ ├── activity_star.go │ │ │ ├── activity_star_test.go │ │ │ ├── activity_test.go │ │ │ ├── activity_watching.go │ │ │ ├── activity_watching_test.go │ │ │ ├── admin.go │ │ │ ├── admin_test.go │ │ │ ├── apps.go │ │ │ ├── apps_installation.go │ │ │ ├── apps_installation_test.go │ │ │ ├── apps_test.go │ │ │ ├── authorizations.go │ │ │ ├── authorizations_test.go │ │ │ ├── doc.go │ │ │ ├── event_types.go │ │ │ ├── examples_test.go │ │ │ ├── gen-accessors.go │ │ │ ├── gists.go │ │ │ ├── gists_comments.go │ │ │ ├── gists_comments_test.go │ │ │ ├── gists_test.go │ │ │ ├── git.go │ │ │ ├── git_blobs.go │ │ │ ├── git_blobs_test.go │ │ │ ├── git_commits.go │ │ │ ├── git_commits_test.go │ │ │ ├── git_refs.go │ │ │ ├── git_refs_test.go │ │ │ ├── git_tags.go │ │ │ ├── git_tags_test.go │ │ │ ├── git_trees.go │ │ │ ├── git_trees_test.go │ │ │ ├── github-accessors.go │ │ │ ├── github.go │ │ │ ├── github_test.go │ │ │ ├── gitignore.go │ │ │ ├── gitignore_test.go │ │ │ ├── issues.go │ │ │ ├── issues_assignees.go │ │ │ ├── issues_assignees_test.go │ │ │ ├── issues_comments.go │ │ │ ├── issues_comments_test.go │ │ │ ├── issues_events.go │ │ │ ├── issues_events_test.go │ │ │ ├── issues_labels.go │ │ │ ├── issues_labels_test.go │ │ │ ├── issues_milestones.go │ │ │ ├── issues_milestones_test.go │ │ │ ├── issues_test.go │ │ │ ├── issues_timeline.go │ │ │ ├── issues_timeline_test.go │ │ │ ├── licenses.go │ │ │ ├── licenses_test.go │ │ │ ├── messages.go │ │ │ ├── messages_test.go │ │ │ ├── migrations.go │ │ │ ├── migrations_source_import.go │ │ │ ├── migrations_source_import_test.go │ │ │ ├── migrations_test.go │ │ │ ├── misc.go │ │ │ ├── misc_test.go │ │ │ ├── orgs.go │ │ │ ├── orgs_hooks.go │ │ │ ├── orgs_hooks_test.go │ │ │ ├── orgs_members.go │ │ │ ├── orgs_members_test.go │ │ │ ├── orgs_outside_collaborators.go │ │ │ ├── orgs_outside_collaborators_test.go │ │ │ ├── orgs_projects.go │ │ │ ├── orgs_projects_test.go │ │ │ ├── orgs_teams.go │ │ │ ├── orgs_teams_test.go │ │ │ ├── orgs_test.go │ │ │ ├── orgs_users_blocking.go │ │ │ ├── orgs_users_blocking_test.go │ │ │ ├── projects.go │ │ │ ├── projects_test.go │ │ │ ├── pulls.go │ │ │ ├── pulls_comments.go │ │ │ ├── pulls_comments_test.go │ │ │ ├── pulls_reviewers.go │ │ │ ├── pulls_reviewers_test.go │ │ │ ├── pulls_reviews.go │ │ │ ├── pulls_reviews_test.go │ │ │ ├── pulls_test.go │ │ │ ├── reactions.go │ │ │ ├── reactions_test.go │ │ │ ├── repos.go │ │ │ ├── repos_collaborators.go │ │ │ ├── repos_collaborators_test.go │ │ │ ├── repos_comments.go │ │ │ ├── repos_comments_test.go │ │ │ ├── repos_commits.go │ │ │ ├── repos_commits_test.go │ │ │ ├── repos_community_health.go │ │ │ ├── repos_community_health_test.go │ │ │ ├── repos_contents.go │ │ │ ├── repos_contents_test.go │ │ │ ├── repos_deployments.go │ │ │ ├── repos_deployments_test.go │ │ │ ├── repos_forks.go │ │ │ ├── repos_forks_test.go │ │ │ ├── repos_hooks.go │ │ │ ├── repos_hooks_test.go │ │ │ ├── repos_invitations.go │ │ │ ├── repos_invitations_test.go │ │ │ ├── repos_keys.go │ │ │ ├── repos_keys_test.go │ │ │ ├── repos_merging.go │ │ │ ├── repos_merging_test.go │ │ │ ├── repos_pages.go │ │ │ ├── repos_pages_test.go │ │ │ ├── repos_projects.go │ │ │ ├── repos_projects_test.go │ │ │ ├── repos_releases.go │ │ │ ├── repos_releases_test.go │ │ │ ├── repos_stats.go │ │ │ ├── repos_stats_test.go │ │ │ ├── repos_statuses.go │ │ │ ├── repos_statuses_test.go │ │ │ ├── repos_test.go │ │ │ ├── repos_traffic.go │ │ │ ├── repos_traffic_test.go │ │ │ ├── search.go │ │ │ ├── search_test.go │ │ │ ├── strings.go │ │ │ ├── strings_test.go │ │ │ ├── timestamp.go │ │ │ ├── timestamp_test.go │ │ │ ├── users.go │ │ │ ├── users_administration.go │ │ │ ├── users_administration_test.go │ │ │ ├── users_blocking.go │ │ │ ├── users_blocking_test.go │ │ │ ├── users_emails.go │ │ │ ├── users_emails_test.go │ │ │ ├── users_followers.go │ │ │ ├── users_followers_test.go │ │ │ ├── users_gpg_keys.go │ │ │ ├── users_gpg_keys_test.go │ │ │ ├── users_keys.go │ │ │ ├── users_keys_test.go │ │ │ ├── users_test.go │ │ │ ├── with_appengine.go │ │ │ └── without_appengine.go │ │ └── tests │ │ │ ├── README.md │ │ │ ├── fields │ │ │ └── fields.go │ │ │ └── integration │ │ │ ├── activity_test.go │ │ │ ├── authorizations_test.go │ │ │ ├── doc.go │ │ │ ├── github_test.go │ │ │ ├── issues_test.go │ │ │ ├── misc_test.go │ │ │ ├── pulls_test.go │ │ │ ├── repos_test.go │ │ │ └── users_test.go │ │ └── go-querystring │ │ ├── .gitignore │ │ ├── CONTRIBUTING.md │ │ ├── LICENSE │ │ ├── README.md │ │ └── query │ │ ├── encode.go │ │ └── encode_test.go ├── golang.org │ └── x │ │ ├── net │ │ ├── .gitattributes │ │ ├── .gitignore │ │ ├── AUTHORS │ │ ├── CONTRIBUTING.md │ │ ├── CONTRIBUTORS │ │ ├── LICENSE │ │ ├── PATENTS │ │ ├── README │ │ ├── bpf │ │ │ ├── asm.go │ │ │ ├── constants.go │ │ │ ├── doc.go │ │ │ ├── instructions.go │ │ │ ├── instructions_test.go │ │ │ ├── setter.go │ │ │ ├── testdata │ │ │ │ ├── all_instructions.bpf │ │ │ │ └── all_instructions.txt │ │ │ ├── vm.go │ │ │ ├── vm_aluop_test.go │ │ │ ├── vm_bpf_test.go │ │ │ ├── vm_extension_test.go │ │ │ ├── vm_instructions.go │ │ │ ├── vm_jump_test.go │ │ │ ├── vm_load_test.go │ │ │ ├── vm_ret_test.go │ │ │ ├── vm_scratch_test.go │ │ │ └── vm_test.go │ │ ├── codereview.cfg │ │ ├── context │ │ │ ├── context.go │ │ │ ├── context_test.go │ │ │ ├── ctxhttp │ │ │ │ ├── ctxhttp.go │ │ │ │ ├── ctxhttp_17_test.go │ │ │ │ ├── ctxhttp_pre17.go │ │ │ │ ├── ctxhttp_pre17_test.go │ │ │ │ └── ctxhttp_test.go │ │ │ ├── go17.go │ │ │ ├── pre_go17.go │ │ │ └── withtimeout_test.go │ │ ├── dict │ │ │ └── dict.go │ │ ├── dns │ │ │ └── dnsmessage │ │ │ │ ├── example_test.go │ │ │ │ ├── message.go │ │ │ │ └── message_test.go │ │ ├── html │ │ │ ├── atom │ │ │ │ ├── atom.go │ │ │ │ ├── atom_test.go │ │ │ │ ├── gen.go │ │ │ │ ├── table.go │ │ │ │ └── table_test.go │ │ │ ├── charset │ │ │ │ ├── charset.go │ │ │ │ ├── charset_test.go │ │ │ │ └── testdata │ │ │ │ │ ├── HTTP-charset.html │ │ │ │ │ ├── HTTP-vs-UTF-8-BOM.html │ │ │ │ │ ├── HTTP-vs-meta-charset.html │ │ │ │ │ ├── HTTP-vs-meta-content.html │ │ │ │ │ ├── No-encoding-declaration.html │ │ │ │ │ ├── README │ │ │ │ │ ├── UTF-16BE-BOM.html │ │ │ │ │ ├── UTF-16LE-BOM.html │ │ │ │ │ ├── UTF-8-BOM-vs-meta-charset.html │ │ │ │ │ ├── UTF-8-BOM-vs-meta-content.html │ │ │ │ │ ├── meta-charset-attribute.html │ │ │ │ │ └── meta-content-attribute.html │ │ │ ├── const.go │ │ │ ├── doc.go │ │ │ ├── doctype.go │ │ │ ├── entity.go │ │ │ ├── entity_test.go │ │ │ ├── escape.go │ │ │ ├── escape_test.go │ │ │ ├── example_test.go │ │ │ ├── foreign.go │ │ │ ├── node.go │ │ │ ├── node_test.go │ │ │ ├── parse.go │ │ │ ├── parse_test.go │ │ │ ├── render.go │ │ │ ├── render_test.go │ │ │ ├── testdata │ │ │ │ ├── go1.html │ │ │ │ └── webkit │ │ │ │ │ ├── README │ │ │ │ │ ├── adoption01.dat │ │ │ │ │ ├── adoption02.dat │ │ │ │ │ ├── comments01.dat │ │ │ │ │ ├── doctype01.dat │ │ │ │ │ ├── entities01.dat │ │ │ │ │ ├── entities02.dat │ │ │ │ │ ├── html5test-com.dat │ │ │ │ │ ├── inbody01.dat │ │ │ │ │ ├── isindex.dat │ │ │ │ │ ├── pending-spec-changes-plain-text-unsafe.dat │ │ │ │ │ ├── pending-spec-changes.dat │ │ │ │ │ ├── plain-text-unsafe.dat │ │ │ │ │ ├── scriptdata01.dat │ │ │ │ │ ├── scripted │ │ │ │ │ ├── adoption01.dat │ │ │ │ │ └── webkit01.dat │ │ │ │ │ ├── tables01.dat │ │ │ │ │ ├── tests1.dat │ │ │ │ │ ├── tests10.dat │ │ │ │ │ ├── tests11.dat │ │ │ │ │ ├── tests12.dat │ │ │ │ │ ├── tests14.dat │ │ │ │ │ ├── tests15.dat │ │ │ │ │ ├── tests16.dat │ │ │ │ │ ├── tests17.dat │ │ │ │ │ ├── tests18.dat │ │ │ │ │ ├── tests19.dat │ │ │ │ │ ├── tests2.dat │ │ │ │ │ ├── tests20.dat │ │ │ │ │ ├── tests21.dat │ │ │ │ │ ├── tests22.dat │ │ │ │ │ ├── tests23.dat │ │ │ │ │ ├── tests24.dat │ │ │ │ │ ├── tests25.dat │ │ │ │ │ ├── tests26.dat │ │ │ │ │ ├── tests3.dat │ │ │ │ │ ├── tests4.dat │ │ │ │ │ ├── tests5.dat │ │ │ │ │ ├── tests6.dat │ │ │ │ │ ├── tests7.dat │ │ │ │ │ ├── tests8.dat │ │ │ │ │ ├── tests9.dat │ │ │ │ │ ├── tests_innerHTML_1.dat │ │ │ │ │ ├── tricky01.dat │ │ │ │ │ ├── webkit01.dat │ │ │ │ │ └── webkit02.dat │ │ │ ├── token.go │ │ │ └── token_test.go │ │ ├── http2 │ │ │ ├── .gitignore │ │ │ ├── Dockerfile │ │ │ ├── Makefile │ │ │ ├── README │ │ │ ├── ciphers.go │ │ │ ├── ciphers_test.go │ │ │ ├── client_conn_pool.go │ │ │ ├── configure_transport.go │ │ │ ├── databuffer.go │ │ │ ├── databuffer_test.go │ │ │ ├── errors.go │ │ │ ├── errors_test.go │ │ │ ├── flow.go │ │ │ ├── flow_test.go │ │ │ ├── frame.go │ │ │ ├── frame_test.go │ │ │ ├── go16.go │ │ │ ├── go17.go │ │ │ ├── go17_not18.go │ │ │ ├── go18.go │ │ │ ├── go18_test.go │ │ │ ├── go19.go │ │ │ ├── go19_test.go │ │ │ ├── gotrack.go │ │ │ ├── gotrack_test.go │ │ │ ├── h2demo │ │ │ │ ├── .gitignore │ │ │ │ ├── Makefile │ │ │ │ ├── README │ │ │ │ ├── h2demo.go │ │ │ │ ├── launch.go │ │ │ │ ├── rootCA.key │ │ │ │ ├── rootCA.pem │ │ │ │ ├── rootCA.srl │ │ │ │ ├── server.crt │ │ │ │ ├── server.key │ │ │ │ └── tmpl.go │ │ │ ├── h2i │ │ │ │ ├── README.md │ │ │ │ └── h2i.go │ │ │ ├── headermap.go │ │ │ ├── hpack │ │ │ │ ├── encode.go │ │ │ │ ├── encode_test.go │ │ │ │ ├── hpack.go │ │ │ │ ├── hpack_test.go │ │ │ │ ├── huffman.go │ │ │ │ ├── tables.go │ │ │ │ └── tables_test.go │ │ │ ├── http2.go │ │ │ ├── http2_test.go │ │ │ ├── not_go16.go │ │ │ ├── not_go17.go │ │ │ ├── not_go18.go │ │ │ ├── not_go19.go │ │ │ ├── pipe.go │ │ │ ├── pipe_test.go │ │ │ ├── server.go │ │ │ ├── server_push_test.go │ │ │ ├── server_test.go │ │ │ ├── testdata │ │ │ │ └── draft-ietf-httpbis-http2.xml │ │ │ ├── transport.go │ │ │ ├── transport_test.go │ │ │ ├── write.go │ │ │ ├── writesched.go │ │ │ ├── writesched_priority.go │ │ │ ├── writesched_priority_test.go │ │ │ ├── writesched_random.go │ │ │ ├── writesched_random_test.go │ │ │ ├── writesched_test.go │ │ │ └── z_spec_test.go │ │ ├── icmp │ │ │ ├── dstunreach.go │ │ │ ├── echo.go │ │ │ ├── endpoint.go │ │ │ ├── example_test.go │ │ │ ├── extension.go │ │ │ ├── extension_test.go │ │ │ ├── helper_posix.go │ │ │ ├── interface.go │ │ │ ├── ipv4.go │ │ │ ├── ipv4_test.go │ │ │ ├── ipv6.go │ │ │ ├── listen_posix.go │ │ │ ├── listen_stub.go │ │ │ ├── message.go │ │ │ ├── message_test.go │ │ │ ├── messagebody.go │ │ │ ├── mpls.go │ │ │ ├── multipart.go │ │ │ ├── multipart_test.go │ │ │ ├── packettoobig.go │ │ │ ├── paramprob.go │ │ │ ├── ping_test.go │ │ │ ├── sys_freebsd.go │ │ │ └── timeexceeded.go │ │ ├── idna │ │ │ ├── example_test.go │ │ │ ├── idna.go │ │ │ ├── idna_test.go │ │ │ ├── punycode.go │ │ │ ├── punycode_test.go │ │ │ ├── tables.go │ │ │ ├── trie.go │ │ │ └── trieval.go │ │ ├── internal │ │ │ ├── iana │ │ │ │ ├── const.go │ │ │ │ └── gen.go │ │ │ ├── nettest │ │ │ │ ├── helper_bsd.go │ │ │ │ ├── helper_nobsd.go │ │ │ │ ├── helper_posix.go │ │ │ │ ├── helper_stub.go │ │ │ │ ├── helper_unix.go │ │ │ │ ├── helper_windows.go │ │ │ │ ├── interface.go │ │ │ │ ├── rlimit.go │ │ │ │ └── stack.go │ │ │ ├── socket │ │ │ │ ├── cmsghdr.go │ │ │ │ ├── cmsghdr_bsd.go │ │ │ │ ├── cmsghdr_linux_32bit.go │ │ │ │ ├── cmsghdr_linux_64bit.go │ │ │ │ ├── cmsghdr_solaris_64bit.go │ │ │ │ ├── cmsghdr_stub.go │ │ │ │ ├── defs_darwin.go │ │ │ │ ├── defs_dragonfly.go │ │ │ │ ├── defs_freebsd.go │ │ │ │ ├── defs_linux.go │ │ │ │ ├── defs_netbsd.go │ │ │ │ ├── defs_openbsd.go │ │ │ │ ├── defs_solaris.go │ │ │ │ ├── error_unix.go │ │ │ │ ├── error_windows.go │ │ │ │ ├── iovec_32bit.go │ │ │ │ ├── iovec_64bit.go │ │ │ │ ├── iovec_solaris_64bit.go │ │ │ │ ├── iovec_stub.go │ │ │ │ ├── mmsghdr_stub.go │ │ │ │ ├── mmsghdr_unix.go │ │ │ │ ├── msghdr_bsd.go │ │ │ │ ├── msghdr_bsdvar.go │ │ │ │ ├── msghdr_linux.go │ │ │ │ ├── msghdr_linux_32bit.go │ │ │ │ ├── msghdr_linux_64bit.go │ │ │ │ ├── msghdr_openbsd.go │ │ │ │ ├── msghdr_solaris_64bit.go │ │ │ │ ├── msghdr_stub.go │ │ │ │ ├── rawconn.go │ │ │ │ ├── rawconn_mmsg.go │ │ │ │ ├── rawconn_msg.go │ │ │ │ ├── rawconn_nommsg.go │ │ │ │ ├── rawconn_nomsg.go │ │ │ │ ├── rawconn_stub.go │ │ │ │ ├── reflect.go │ │ │ │ ├── socket.go │ │ │ │ ├── socket_go1_9_test.go │ │ │ │ ├── socket_test.go │ │ │ │ ├── sys.go │ │ │ │ ├── sys_bsd.go │ │ │ │ ├── sys_bsdvar.go │ │ │ │ ├── sys_darwin.go │ │ │ │ ├── sys_dragonfly.go │ │ │ │ ├── sys_linux.go │ │ │ │ ├── sys_linux_386.go │ │ │ │ ├── sys_linux_386.s │ │ │ │ ├── sys_linux_amd64.go │ │ │ │ ├── sys_linux_arm.go │ │ │ │ ├── sys_linux_arm64.go │ │ │ │ ├── sys_linux_mips.go │ │ │ │ ├── sys_linux_mips64.go │ │ │ │ ├── sys_linux_mips64le.go │ │ │ │ ├── sys_linux_mipsle.go │ │ │ │ ├── sys_linux_ppc64.go │ │ │ │ ├── sys_linux_ppc64le.go │ │ │ │ ├── sys_linux_s390x.go │ │ │ │ ├── sys_linux_s390x.s │ │ │ │ ├── sys_netbsd.go │ │ │ │ ├── sys_posix.go │ │ │ │ ├── sys_solaris.go │ │ │ │ ├── sys_solaris_amd64.s │ │ │ │ ├── sys_stub.go │ │ │ │ ├── sys_unix.go │ │ │ │ ├── sys_windows.go │ │ │ │ ├── zsys_darwin_386.go │ │ │ │ ├── zsys_darwin_amd64.go │ │ │ │ ├── zsys_darwin_arm.go │ │ │ │ ├── zsys_dragonfly_amd64.go │ │ │ │ ├── zsys_freebsd_386.go │ │ │ │ ├── zsys_freebsd_amd64.go │ │ │ │ ├── zsys_freebsd_arm.go │ │ │ │ ├── zsys_linux_386.go │ │ │ │ ├── zsys_linux_amd64.go │ │ │ │ ├── zsys_linux_arm.go │ │ │ │ ├── zsys_linux_arm64.go │ │ │ │ ├── zsys_linux_mips.go │ │ │ │ ├── zsys_linux_mips64.go │ │ │ │ ├── zsys_linux_mips64le.go │ │ │ │ ├── zsys_linux_mipsle.go │ │ │ │ ├── zsys_linux_ppc64.go │ │ │ │ ├── zsys_linux_ppc64le.go │ │ │ │ ├── zsys_linux_s390x.go │ │ │ │ ├── zsys_netbsd_386.go │ │ │ │ ├── zsys_netbsd_amd64.go │ │ │ │ ├── zsys_netbsd_arm.go │ │ │ │ ├── zsys_openbsd_386.go │ │ │ │ ├── zsys_openbsd_amd64.go │ │ │ │ ├── zsys_openbsd_arm.go │ │ │ │ └── zsys_solaris_amd64.go │ │ │ └── timeseries │ │ │ │ ├── timeseries.go │ │ │ │ └── timeseries_test.go │ │ ├── ipv4 │ │ │ ├── batch.go │ │ │ ├── bpf_test.go │ │ │ ├── control.go │ │ │ ├── control_bsd.go │ │ │ ├── control_pktinfo.go │ │ │ ├── control_stub.go │ │ │ ├── control_test.go │ │ │ ├── control_unix.go │ │ │ ├── control_windows.go │ │ │ ├── defs_darwin.go │ │ │ ├── defs_dragonfly.go │ │ │ ├── defs_freebsd.go │ │ │ ├── defs_linux.go │ │ │ ├── defs_netbsd.go │ │ │ ├── defs_openbsd.go │ │ │ ├── defs_solaris.go │ │ │ ├── dgramopt.go │ │ │ ├── doc.go │ │ │ ├── endpoint.go │ │ │ ├── example_test.go │ │ │ ├── gen.go │ │ │ ├── genericopt.go │ │ │ ├── header.go │ │ │ ├── header_test.go │ │ │ ├── helper.go │ │ │ ├── iana.go │ │ │ ├── icmp.go │ │ │ ├── icmp_linux.go │ │ │ ├── icmp_stub.go │ │ │ ├── icmp_test.go │ │ │ ├── multicast_test.go │ │ │ ├── multicastlistener_test.go │ │ │ ├── multicastsockopt_test.go │ │ │ ├── packet.go │ │ │ ├── packet_go1_8.go │ │ │ ├── packet_go1_9.go │ │ │ ├── payload.go │ │ │ ├── payload_cmsg.go │ │ │ ├── payload_cmsg_go1_8.go │ │ │ ├── payload_cmsg_go1_9.go │ │ │ ├── payload_nocmsg.go │ │ │ ├── readwrite_go1_8_test.go │ │ │ ├── readwrite_go1_9_test.go │ │ │ ├── readwrite_test.go │ │ │ ├── sockopt.go │ │ │ ├── sockopt_posix.go │ │ │ ├── sockopt_stub.go │ │ │ ├── sys_asmreq.go │ │ │ ├── sys_asmreq_stub.go │ │ │ ├── sys_asmreqn.go │ │ │ ├── sys_asmreqn_stub.go │ │ │ ├── sys_bpf.go │ │ │ ├── sys_bpf_stub.go │ │ │ ├── sys_bsd.go │ │ │ ├── sys_darwin.go │ │ │ ├── sys_dragonfly.go │ │ │ ├── sys_freebsd.go │ │ │ ├── sys_linux.go │ │ │ ├── sys_solaris.go │ │ │ ├── sys_ssmreq.go │ │ │ ├── sys_ssmreq_stub.go │ │ │ ├── sys_stub.go │ │ │ ├── sys_windows.go │ │ │ ├── unicast_test.go │ │ │ ├── unicastsockopt_test.go │ │ │ ├── zsys_darwin.go │ │ │ ├── zsys_dragonfly.go │ │ │ ├── zsys_freebsd_386.go │ │ │ ├── zsys_freebsd_amd64.go │ │ │ ├── zsys_freebsd_arm.go │ │ │ ├── zsys_linux_386.go │ │ │ ├── zsys_linux_amd64.go │ │ │ ├── zsys_linux_arm.go │ │ │ ├── zsys_linux_arm64.go │ │ │ ├── zsys_linux_mips.go │ │ │ ├── zsys_linux_mips64.go │ │ │ ├── zsys_linux_mips64le.go │ │ │ ├── zsys_linux_mipsle.go │ │ │ ├── zsys_linux_ppc.go │ │ │ ├── zsys_linux_ppc64.go │ │ │ ├── zsys_linux_ppc64le.go │ │ │ ├── zsys_linux_s390x.go │ │ │ ├── zsys_netbsd.go │ │ │ ├── zsys_openbsd.go │ │ │ └── zsys_solaris.go │ │ ├── ipv6 │ │ │ ├── batch.go │ │ │ ├── bpf_test.go │ │ │ ├── control.go │ │ │ ├── control_rfc2292_unix.go │ │ │ ├── control_rfc3542_unix.go │ │ │ ├── control_stub.go │ │ │ ├── control_test.go │ │ │ ├── control_unix.go │ │ │ ├── control_windows.go │ │ │ ├── defs_darwin.go │ │ │ ├── defs_dragonfly.go │ │ │ ├── defs_freebsd.go │ │ │ ├── defs_linux.go │ │ │ ├── defs_netbsd.go │ │ │ ├── defs_openbsd.go │ │ │ ├── defs_solaris.go │ │ │ ├── dgramopt.go │ │ │ ├── doc.go │ │ │ ├── endpoint.go │ │ │ ├── example_test.go │ │ │ ├── gen.go │ │ │ ├── genericopt.go │ │ │ ├── header.go │ │ │ ├── header_test.go │ │ │ ├── helper.go │ │ │ ├── iana.go │ │ │ ├── icmp.go │ │ │ ├── icmp_bsd.go │ │ │ ├── icmp_linux.go │ │ │ ├── icmp_solaris.go │ │ │ ├── icmp_stub.go │ │ │ ├── icmp_test.go │ │ │ ├── icmp_windows.go │ │ │ ├── mocktransponder_test.go │ │ │ ├── multicast_test.go │ │ │ ├── multicastlistener_test.go │ │ │ ├── multicastsockopt_test.go │ │ │ ├── payload.go │ │ │ ├── payload_cmsg.go │ │ │ ├── payload_cmsg_go1_8.go │ │ │ ├── payload_cmsg_go1_9.go │ │ │ ├── payload_nocmsg.go │ │ │ ├── readwrite_go1_8_test.go │ │ │ ├── readwrite_go1_9_test.go │ │ │ ├── readwrite_test.go │ │ │ ├── sockopt.go │ │ │ ├── sockopt_posix.go │ │ │ ├── sockopt_stub.go │ │ │ ├── sockopt_test.go │ │ │ ├── sys_asmreq.go │ │ │ ├── sys_asmreq_stub.go │ │ │ ├── sys_bpf.go │ │ │ ├── sys_bpf_stub.go │ │ │ ├── sys_bsd.go │ │ │ ├── sys_darwin.go │ │ │ ├── sys_freebsd.go │ │ │ ├── sys_linux.go │ │ │ ├── sys_solaris.go │ │ │ ├── sys_ssmreq.go │ │ │ ├── sys_ssmreq_stub.go │ │ │ ├── sys_stub.go │ │ │ ├── sys_windows.go │ │ │ ├── unicast_test.go │ │ │ ├── unicastsockopt_test.go │ │ │ ├── zsys_darwin.go │ │ │ ├── zsys_dragonfly.go │ │ │ ├── zsys_freebsd_386.go │ │ │ ├── zsys_freebsd_amd64.go │ │ │ ├── zsys_freebsd_arm.go │ │ │ ├── zsys_linux_386.go │ │ │ ├── zsys_linux_amd64.go │ │ │ ├── zsys_linux_arm.go │ │ │ ├── zsys_linux_arm64.go │ │ │ ├── zsys_linux_mips.go │ │ │ ├── zsys_linux_mips64.go │ │ │ ├── zsys_linux_mips64le.go │ │ │ ├── zsys_linux_mipsle.go │ │ │ ├── zsys_linux_ppc.go │ │ │ ├── zsys_linux_ppc64.go │ │ │ ├── zsys_linux_ppc64le.go │ │ │ ├── zsys_linux_s390x.go │ │ │ ├── zsys_netbsd.go │ │ │ ├── zsys_openbsd.go │ │ │ └── zsys_solaris.go │ │ ├── lex │ │ │ └── httplex │ │ │ │ ├── httplex.go │ │ │ │ └── httplex_test.go │ │ ├── lif │ │ │ ├── address.go │ │ │ ├── address_test.go │ │ │ ├── binary.go │ │ │ ├── defs_solaris.go │ │ │ ├── lif.go │ │ │ ├── link.go │ │ │ ├── link_test.go │ │ │ ├── sys.go │ │ │ ├── sys_solaris_amd64.s │ │ │ ├── syscall.go │ │ │ └── zsys_solaris_amd64.go │ │ ├── nettest │ │ │ ├── conntest.go │ │ │ ├── conntest_go16.go │ │ │ ├── conntest_go17.go │ │ │ └── conntest_test.go │ │ ├── netutil │ │ │ ├── listen.go │ │ │ └── listen_test.go │ │ ├── proxy │ │ │ ├── direct.go │ │ │ ├── per_host.go │ │ │ ├── per_host_test.go │ │ │ ├── proxy.go │ │ │ ├── proxy_test.go │ │ │ └── socks5.go │ │ ├── publicsuffix │ │ │ ├── gen.go │ │ │ ├── list.go │ │ │ ├── list_test.go │ │ │ ├── table.go │ │ │ └── table_test.go │ │ ├── route │ │ │ ├── address.go │ │ │ ├── address_darwin_test.go │ │ │ ├── address_test.go │ │ │ ├── binary.go │ │ │ ├── defs_darwin.go │ │ │ ├── defs_dragonfly.go │ │ │ ├── defs_freebsd.go │ │ │ ├── defs_netbsd.go │ │ │ ├── defs_openbsd.go │ │ │ ├── interface.go │ │ │ ├── interface_announce.go │ │ │ ├── interface_classic.go │ │ │ ├── interface_freebsd.go │ │ │ ├── interface_multicast.go │ │ │ ├── interface_openbsd.go │ │ │ ├── message.go │ │ │ ├── message_darwin_test.go │ │ │ ├── message_freebsd_test.go │ │ │ ├── message_test.go │ │ │ ├── route.go │ │ │ ├── route_classic.go │ │ │ ├── route_openbsd.go │ │ │ ├── route_test.go │ │ │ ├── sys.go │ │ │ ├── sys_darwin.go │ │ │ ├── sys_dragonfly.go │ │ │ ├── sys_freebsd.go │ │ │ ├── sys_netbsd.go │ │ │ ├── sys_openbsd.go │ │ │ ├── syscall.go │ │ │ ├── zsys_darwin.go │ │ │ ├── zsys_dragonfly.go │ │ │ ├── zsys_freebsd_386.go │ │ │ ├── zsys_freebsd_amd64.go │ │ │ ├── zsys_freebsd_arm.go │ │ │ ├── zsys_netbsd.go │ │ │ └── zsys_openbsd.go │ │ ├── trace │ │ │ ├── events.go │ │ │ ├── histogram.go │ │ │ ├── histogram_test.go │ │ │ ├── trace.go │ │ │ ├── trace_go16.go │ │ │ ├── trace_go17.go │ │ │ └── trace_test.go │ │ ├── webdav │ │ │ ├── file.go │ │ │ ├── file_go1.6.go │ │ │ ├── file_go1.7.go │ │ │ ├── file_test.go │ │ │ ├── if.go │ │ │ ├── if_test.go │ │ │ ├── internal │ │ │ │ └── xml │ │ │ │ │ ├── README │ │ │ │ │ ├── atom_test.go │ │ │ │ │ ├── example_test.go │ │ │ │ │ ├── marshal.go │ │ │ │ │ ├── marshal_test.go │ │ │ │ │ ├── read.go │ │ │ │ │ ├── read_test.go │ │ │ │ │ ├── typeinfo.go │ │ │ │ │ ├── xml.go │ │ │ │ │ └── xml_test.go │ │ │ ├── litmus_test_server.go │ │ │ ├── lock.go │ │ │ ├── lock_test.go │ │ │ ├── prop.go │ │ │ ├── prop_test.go │ │ │ ├── webdav.go │ │ │ ├── webdav_test.go │ │ │ ├── xml.go │ │ │ └── xml_test.go │ │ ├── websocket │ │ │ ├── client.go │ │ │ ├── dial.go │ │ │ ├── dial_test.go │ │ │ ├── exampledial_test.go │ │ │ ├── examplehandler_test.go │ │ │ ├── hybi.go │ │ │ ├── hybi_test.go │ │ │ ├── server.go │ │ │ ├── websocket.go │ │ │ └── websocket_test.go │ │ └── xsrftoken │ │ │ ├── xsrf.go │ │ │ └── xsrf_test.go │ │ └── oauth2 │ │ ├── .travis.yml │ │ ├── AUTHORS │ │ ├── CONTRIBUTING.md │ │ ├── CONTRIBUTORS │ │ ├── LICENSE │ │ ├── README.md │ │ ├── amazon │ │ └── amazon.go │ │ ├── bitbucket │ │ └── bitbucket.go │ │ ├── client_appengine.go │ │ ├── clientcredentials │ │ ├── clientcredentials.go │ │ └── clientcredentials_test.go │ │ ├── example_test.go │ │ ├── facebook │ │ └── facebook.go │ │ ├── fitbit │ │ └── fitbit.go │ │ ├── foursquare │ │ └── foursquare.go │ │ ├── github │ │ └── github.go │ │ ├── google │ │ ├── appengine.go │ │ ├── appengine_hook.go │ │ ├── appengineflex_hook.go │ │ ├── default.go │ │ ├── example_test.go │ │ ├── google.go │ │ ├── google_test.go │ │ ├── jwt.go │ │ ├── jwt_test.go │ │ ├── sdk.go │ │ ├── sdk_test.go │ │ └── testdata │ │ │ └── gcloud │ │ │ ├── credentials │ │ │ └── properties │ │ ├── heroku │ │ └── heroku.go │ │ ├── hipchat │ │ └── hipchat.go │ │ ├── internal │ │ ├── oauth2.go │ │ ├── oauth2_test.go │ │ ├── token.go │ │ ├── token_test.go │ │ ├── transport.go │ │ └── transport_test.go │ │ ├── jws │ │ ├── jws.go │ │ └── jws_test.go │ │ ├── jwt │ │ ├── example_test.go │ │ ├── jwt.go │ │ └── jwt_test.go │ │ ├── linkedin │ │ └── linkedin.go │ │ ├── mediamath │ │ └── mediamath.go │ │ ├── microsoft │ │ └── microsoft.go │ │ ├── oauth2.go │ │ ├── oauth2_test.go │ │ ├── odnoklassniki │ │ └── odnoklassniki.go │ │ ├── paypal │ │ └── paypal.go │ │ ├── slack │ │ └── slack.go │ │ ├── token.go │ │ ├── token_test.go │ │ ├── transport.go │ │ ├── transport_test.go │ │ ├── uber │ │ └── uber.go │ │ ├── vk │ │ └── vk.go │ │ └── yandex │ │ └── yandex.go └── google.golang.org │ └── appengine │ ├── .travis.yml │ ├── LICENSE │ ├── README.md │ ├── aetest │ ├── doc.go │ ├── instance.go │ ├── instance_classic.go │ ├── instance_test.go │ ├── instance_vm.go │ └── user.go │ ├── appengine.go │ ├── appengine_test.go │ ├── appengine_vm.go │ ├── blobstore │ ├── blobstore.go │ ├── blobstore_test.go │ └── read.go │ ├── capability │ └── capability.go │ ├── channel │ ├── channel.go │ └── channel_test.go │ ├── cloudsql │ ├── cloudsql.go │ ├── cloudsql_classic.go │ └── cloudsql_vm.go │ ├── cmd │ ├── aebundler │ │ └── aebundler.go │ ├── aedeploy │ │ └── aedeploy.go │ └── aefix │ │ ├── ae.go │ │ ├── ae_test.go │ │ ├── fix.go │ │ ├── main.go │ │ ├── main_test.go │ │ └── typecheck.go │ ├── datastore │ ├── datastore.go │ ├── datastore_test.go │ ├── doc.go │ ├── key.go │ ├── key_test.go │ ├── load.go │ ├── metadata.go │ ├── prop.go │ ├── prop_test.go │ ├── query.go │ ├── query_test.go │ ├── save.go │ ├── time_test.go │ └── transaction.go │ ├── delay │ ├── delay.go │ └── delay_test.go │ ├── demos │ ├── guestbook │ │ ├── app.yaml │ │ ├── favicon.ico │ │ ├── guestbook.go │ │ ├── index.yaml │ │ └── templates │ │ │ └── guestbook.html │ └── helloworld │ │ ├── app.yaml │ │ ├── favicon.ico │ │ └── helloworld.go │ ├── errors.go │ ├── file │ └── file.go │ ├── identity.go │ ├── image │ └── image.go │ ├── internal │ ├── aetesting │ │ └── fake.go │ ├── api.go │ ├── api_classic.go │ ├── api_common.go │ ├── api_race_test.go │ ├── api_test.go │ ├── app_id.go │ ├── app_id_test.go │ ├── app_identity │ │ ├── app_identity_service.pb.go │ │ └── app_identity_service.proto │ ├── base │ │ ├── api_base.pb.go │ │ └── api_base.proto │ ├── blobstore │ │ ├── blobstore_service.pb.go │ │ └── blobstore_service.proto │ ├── capability │ │ ├── capability_service.pb.go │ │ └── capability_service.proto │ ├── channel │ │ ├── channel_service.pb.go │ │ └── channel_service.proto │ ├── datastore │ │ ├── datastore_v3.pb.go │ │ └── datastore_v3.proto │ ├── identity.go │ ├── identity_classic.go │ ├── identity_vm.go │ ├── image │ │ ├── images_service.pb.go │ │ └── images_service.proto │ ├── internal.go │ ├── internal_vm_test.go │ ├── mail │ │ ├── mail_service.pb.go │ │ └── mail_service.proto │ ├── main.go │ ├── main_vm.go │ ├── memcache │ │ ├── memcache_service.pb.go │ │ └── memcache_service.proto │ ├── metadata.go │ ├── modules │ │ ├── modules_service.pb.go │ │ └── modules_service.proto │ ├── net.go │ ├── net_test.go │ ├── regen.sh │ ├── remote_api │ │ ├── remote_api.pb.go │ │ └── remote_api.proto │ ├── search │ │ ├── search.pb.go │ │ └── search.proto │ ├── socket │ │ ├── socket_service.pb.go │ │ └── socket_service.proto │ ├── system │ │ ├── system_service.pb.go │ │ └── system_service.proto │ ├── taskqueue │ │ ├── taskqueue_service.pb.go │ │ └── taskqueue_service.proto │ ├── transaction.go │ ├── urlfetch │ │ ├── urlfetch_service.pb.go │ │ └── urlfetch_service.proto │ ├── user │ │ ├── user_service.pb.go │ │ └── user_service.proto │ └── xmpp │ │ ├── xmpp_service.pb.go │ │ └── xmpp_service.proto │ ├── mail │ ├── mail.go │ └── mail_test.go │ ├── memcache │ ├── memcache.go │ └── memcache_test.go │ ├── module │ ├── module.go │ └── module_test.go │ ├── namespace.go │ ├── namespace_test.go │ ├── remote_api │ ├── client.go │ ├── client_test.go │ └── remote_api.go │ ├── runtime │ ├── runtime.go │ └── runtime_test.go │ ├── search │ ├── doc.go │ ├── field.go │ ├── search.go │ ├── search_test.go │ ├── struct.go │ └── struct_test.go │ ├── socket │ ├── doc.go │ ├── socket_classic.go │ └── socket_vm.go │ ├── taskqueue │ ├── taskqueue.go │ └── taskqueue_test.go │ ├── timeout.go │ ├── urlfetch │ └── urlfetch.go │ ├── user │ ├── oauth.go │ ├── user.go │ ├── user_classic.go │ ├── user_test.go │ └── user_vm.go │ └── xmpp │ ├── xmpp.go │ └── xmpp_test.go ├── verify_pull_request.go ├── verify_pull_request_test.go └── wercker.yml /.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.8.3-alpine3.6 2 | RUN apk --no-cache --update add git 3 | RUN go get github.com/nicolai86/github-rebase-bot 4 | 5 | FROM alpine:3.6 6 | 7 | RUN apk --no-cache --update add ca-certificates git curl && update-ca-certificates 8 | 9 | ENV GITHUB_TOKEN="" \ 10 | GITHUB_OWNER="" \ 11 | GITHUB_REPOS="" \ 12 | GITHUB_MERGE_LABEL="LGTM" \ 13 | PUBLIC_DNS="" 14 | 15 | COPY --from=0 /go/bin/github-rebase-bot / 16 | ADD startup.sh / 17 | 18 | ENTRYPOINT ["/startup.sh"] 19 | -------------------------------------------------------------------------------- /Gopkg.toml: -------------------------------------------------------------------------------- 1 | 2 | # Gopkg.toml example 3 | # 4 | # Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md 5 | # for detailed Gopkg.toml documentation. 6 | # 7 | # required = ["github.com/user/thing/cmd/thing"] 8 | # ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] 9 | # 10 | # [[constraint]] 11 | # name = "github.com/user/project" 12 | # version = "1.0.0" 13 | # 14 | # [[constraint]] 15 | # name = "github.com/user/project2" 16 | # branch = "dev" 17 | # source = "github.com/myfork/project2" 18 | # 19 | # [[override]] 20 | # name = "github.com/x/y" 21 | # version = "2.4.0" 22 | 23 | 24 | [[constraint]] 25 | branch = "master" 26 | name = "golang.org/x/oauth2" 27 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Raphael Randschau 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /event_test.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "sync" 5 | "testing" 6 | 7 | "github.com/google/go-github/github" 8 | ) 9 | 10 | func TestStatusEventBroadcaster(t *testing.T) { 11 | inp := make(chan *github.StatusEvent) 12 | q1 := make(chan *github.StatusEvent) 13 | q2 := make(chan *github.StatusEvent) 14 | b := statusEventBroadcaster{listeners: []chan<- *github.StatusEvent{q1, q2}} 15 | go b.Listen(inp) 16 | defer close(inp) 17 | 18 | w := sync.WaitGroup{} 19 | w.Add(2) 20 | go func() { 21 | <-q1 22 | w.Done() 23 | }() 24 | go func() { 25 | <-q2 26 | w.Done() 27 | }() 28 | inp <- &github.StatusEvent{} 29 | w.Wait() 30 | } 31 | -------------------------------------------------------------------------------- /k8s/deployment.yml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1beta1 2 | kind: Deployment 3 | metadata: 4 | name: rebase-bot 5 | namespace: github 6 | spec: 7 | replicas: 1 8 | revisionHistoryLimit: 3 9 | template: 10 | metadata: 11 | labels: 12 | run: rebase-bot 13 | spec: 14 | serviceAccountName: rebase-robot 15 | containers: 16 | - name: rebase-bot 17 | image: nicolai86/github-rebase-bot:v0.0.9 18 | env: 19 | - name: GITHUB_REPOS 20 | value: nicolai86/github-rebase-bot 21 | - name: GITHUB_MERGE_LABEL 22 | value: LGTM 23 | - name: GITHUB_MAINLINE 24 | value: master 25 | - name: GITHUB_TOKEN 26 | valueFrom: 27 | secretKeyRef: 28 | name: github-config 29 | key: oauth-token 30 | -------------------------------------------------------------------------------- /k8s/namespace.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: github 5 | -------------------------------------------------------------------------------- /k8s/rbac.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ServiceAccount 3 | metadata: 4 | name: rebase-robot 5 | namespace: github 6 | automountServiceAccountToken: true 7 | 8 | --- 9 | kind: Role 10 | apiVersion: rbac.authorization.k8s.io/v1beta1 11 | metadata: 12 | namespace: github 13 | name: svc-reader 14 | rules: 15 | - apiGroups: [""] 16 | resources: ["services"] 17 | verbs: ["get", "list"] 18 | 19 | --- 20 | apiVersion: rbac.authorization.k8s.io/v1beta1 21 | kind: RoleBinding 22 | metadata: 23 | name: svc-readers 24 | namespace: github 25 | subjects: 26 | - kind: ServiceAccount 27 | name: rebase-robot 28 | namespace: github 29 | roleRef: 30 | kind: Role 31 | name: svc-reader 32 | apiGroup: rbac.authorization.k8s.io 33 | -------------------------------------------------------------------------------- /k8s/secrets.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Secret 3 | metadata: 4 | name: github-config 5 | namespace: github 6 | type: Opaque 7 | data: 8 | oauth-token: 9 | -------------------------------------------------------------------------------- /k8s/service.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: rebase-bot 5 | namespace: github 6 | spec: 7 | type: LoadBalancer 8 | selector: 9 | run: rebase-bot 10 | ports: 11 | - 12 | protocol: "TCP" 13 | port: 80 14 | targetPort: 8080 15 | -------------------------------------------------------------------------------- /main_test.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | func intVal(i int) *int { 4 | return &i 5 | } 6 | 7 | func stringVal(s string) *string { 8 | return &s 9 | } 10 | 11 | func boolVal(b bool) *bool { 12 | return &b 13 | } 14 | -------------------------------------------------------------------------------- /merge.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "sync" 5 | 6 | "github.com/google/go-github/github" 7 | ) 8 | 9 | func merge(cs ...<-chan *github.PullRequest) <-chan *github.PullRequest { 10 | var wg sync.WaitGroup 11 | out := make(chan *github.PullRequest) 12 | 13 | output := func(c <-chan *github.PullRequest) { 14 | for evt := range c { 15 | out <- evt 16 | } 17 | wg.Done() 18 | } 19 | wg.Add(len(cs)) 20 | 21 | for _, c := range cs { 22 | go output(c) 23 | } 24 | 25 | go func() { 26 | wg.Wait() 27 | close(out) 28 | }() 29 | return out 30 | } 31 | -------------------------------------------------------------------------------- /merge_test.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/google/go-github/github" 7 | ) 8 | 9 | func TestMerge(t *testing.T) { 10 | c1 := make(chan *github.PullRequest, 2) 11 | c2 := make(chan *github.PullRequest, 2) 12 | c3 := merge(c1, c2) 13 | 14 | c1 <- &github.PullRequest{Number: intVal(1)} 15 | c2 <- &github.PullRequest{Number: intVal(2)} 16 | c2 <- &github.PullRequest{Number: intVal(3)} 17 | 18 | close(c1) 19 | close(c2) 20 | 21 | <-c3 22 | <-c3 23 | <-c3 24 | 25 | if _, ok := (<-c3); ok { 26 | t.Error("Expected c3 to be closed, but isn't") 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /processors/interfaces.go: -------------------------------------------------------------------------------- 1 | package processors 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/google/go-github/github" 7 | "github.com/nicolai86/github-rebase-bot/repo" 8 | ) 9 | 10 | // PullRequestGetter queries github for a specific pull request 11 | type PullRequestGetter interface { 12 | Get(context.Context, string, string, int) (*github.PullRequest, *github.Response, error) 13 | } 14 | 15 | // PullRequestLister queries github for all pull requests 16 | type PullRequestLister interface { 17 | List(context.Context, string, string, *github.PullRequestListOptions) ([]*github.PullRequest, *github.Response, error) 18 | } 19 | 20 | type WorkerCache interface { 21 | Worker(string) (repo.Enqueuer, error) 22 | Update() (string, error) 23 | Cleanup(repo.GitWorktree) error 24 | } 25 | -------------------------------------------------------------------------------- /processors/issues_event.go: -------------------------------------------------------------------------------- 1 | package processors 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/google/go-github/github" 7 | ) 8 | 9 | // IssuesEvent filters out events on issues which are not pull requests 10 | func IssuesEvent(client PullRequestGetter, input <-chan *github.IssuesEvent) <-chan *github.PullRequest { 11 | ret := make(chan *github.PullRequest) 12 | go func() { 13 | for evt := range input { 14 | pr, _, err := client.Get( 15 | context.Background(), 16 | evt.Repo.Owner.GetLogin(), 17 | evt.Repo.GetName(), 18 | evt.Issue.GetNumber()) 19 | if pr == nil || err != nil { 20 | continue 21 | } 22 | ret <- pr 23 | } 24 | close(ret) 25 | }() 26 | return ret 27 | } 28 | -------------------------------------------------------------------------------- /processors/mainline_status_event.go: -------------------------------------------------------------------------------- 1 | package processors 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/google/go-github/github" 7 | ) 8 | 9 | // MainlineStatusEvent takes mainline status events and emits open PRs 10 | func MainlineStatusEvent(repo Repository, client PullRequestLister, input <-chan *github.StatusEvent) <-chan *github.PullRequest { 11 | ret := make(chan *github.PullRequest) 12 | go func() { 13 | for evt := range input { 14 | if evt.GetState() != "success" { 15 | continue 16 | } 17 | 18 | isMainline := false 19 | for _, branch := range evt.Branches { 20 | isMainline = isMainline || *branch.Name == repo.Mainline 21 | } 22 | 23 | if !isMainline { 24 | continue 25 | } 26 | 27 | prs, _, err := client.List( 28 | context.Background(), 29 | repo.Owner, 30 | repo.Name, 31 | &github.PullRequestListOptions{ 32 | State: "open", 33 | }) 34 | if err != nil { 35 | continue 36 | } 37 | for _, pr := range prs { 38 | ret <- pr 39 | } 40 | } 41 | close(ret) 42 | }() 43 | return ret 44 | } 45 | -------------------------------------------------------------------------------- /processors/mainline_status_event_test.go: -------------------------------------------------------------------------------- 1 | package processors 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/google/go-github/github" 7 | ) 8 | 9 | func TestMainlineStatusEvent(t *testing.T) { 10 | ch := make(chan *github.StatusEvent, 1) 11 | 12 | t.Run("adds open PRs on mainline success", func(t *testing.T) { 13 | out := MainlineStatusEvent(Repository{ 14 | Owner: "test", 15 | Name: "test", 16 | Mainline: "master", 17 | }, fakePullRequestResponse(2), ch) 18 | ch <- &github.StatusEvent{ 19 | State: stringVal("success"), 20 | Branches: []*github.Branch{ 21 | { 22 | Name: stringVal("master"), 23 | }, 24 | }, 25 | Repo: &github.Repository{ 26 | Name: stringVal("test"), 27 | Owner: &github.User{ 28 | Login: stringVal("test"), 29 | }, 30 | }, 31 | } 32 | close(ch) 33 | 34 | if _, ok := <-out; !ok { 35 | t.Fatal("Expected output on PR, but didn't receive") 36 | } 37 | if _, ok := <-out; !ok { 38 | t.Fatal("Expected output on PR, but didn't receive") 39 | } 40 | }) 41 | } 42 | -------------------------------------------------------------------------------- /processors/merge.go: -------------------------------------------------------------------------------- 1 | package processors 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/google/go-github/github" 8 | ) 9 | 10 | // Merge executes a merge to mainline via the github api. 11 | func Merge(client *github.Client, input <-chan *github.PullRequest) <-chan *github.PullRequest { 12 | ret := make(chan *github.PullRequest) 13 | go func() { 14 | for pr := range input { 15 | if _, _, err := client.PullRequests.Merge( 16 | context.Background(), 17 | pr.Base.User.GetLogin(), 18 | pr.Base.Repo.GetName(), 19 | pr.GetNumber(), 20 | "merge-bot merged", 21 | &github.PullRequestOptions{ 22 | MergeMethod: "merge", 23 | }); err != nil { 24 | continue 25 | } 26 | 27 | if _, err := client.Git.DeleteRef( 28 | context.Background(), 29 | pr.Base.User.GetLogin(), 30 | pr.Base.Repo.GetName(), 31 | fmt.Sprintf("heads/%s", *pr.Head.Ref), 32 | ); err != nil { 33 | fmt.Printf("Failed deleting branch: %q\n", err) 34 | } 35 | 36 | ret <- pr 37 | } 38 | close(ret) 39 | }() 40 | return ret 41 | } 42 | -------------------------------------------------------------------------------- /processors/processors_test.go: -------------------------------------------------------------------------------- 1 | package processors 2 | 3 | func intVal(i int) *int { 4 | return &i 5 | } 6 | 7 | func stringVal(s string) *string { 8 | return &s 9 | } 10 | 11 | func boolVal(b bool) *bool { 12 | return &b 13 | } 14 | -------------------------------------------------------------------------------- /processors/pull_request_review.go: -------------------------------------------------------------------------------- 1 | package processors 2 | 3 | import "github.com/google/go-github/github" 4 | 5 | func PullRequestReviewEvent(client *github.Client, input <-chan *github.PullRequestReviewEvent) <-chan *github.PullRequest { 6 | ret := make(chan *github.PullRequest) 7 | go func() { 8 | for evt := range input { 9 | ret <- evt.PullRequest 10 | } 11 | close(ret) 12 | }() 13 | return ret 14 | } 15 | -------------------------------------------------------------------------------- /processors/push_event.go: -------------------------------------------------------------------------------- 1 | package processors 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/google/go-github/github" 8 | ) 9 | 10 | // PushEvent emits every open PR once a change on mainline was received. 11 | // This allows the bot to re-check all open PRs once master changed. 12 | func PushEvent(repo Repository, client PullRequestLister, input <-chan *github.PushEvent) <-chan *github.PullRequest { 13 | ret := make(chan *github.PullRequest) 14 | go func() { 15 | for evt := range input { 16 | 17 | if evt.GetRef() != fmt.Sprintf("refs/heads/%s", repo.Mainline) { 18 | continue 19 | } 20 | 21 | prs, _, err := client.List( 22 | context.Background(), 23 | repo.Owner, 24 | repo.Name, 25 | &github.PullRequestListOptions{ 26 | State: "open", 27 | }) 28 | if err != nil { 29 | continue 30 | } 31 | for _, pr := range prs { 32 | ret <- pr 33 | } 34 | } 35 | 36 | close(ret) 37 | }() 38 | return ret 39 | } 40 | -------------------------------------------------------------------------------- /processors/push_event_test.go: -------------------------------------------------------------------------------- 1 | package processors 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/google/go-github/github" 7 | ) 8 | 9 | func TestPushEvent(t *testing.T) { 10 | ch := make(chan *github.PushEvent, 1) 11 | 12 | t.Run("adds open PRs on mainline push", func(t *testing.T) { 13 | out := PushEvent(Repository{ 14 | Owner: "test", 15 | Name: "test", 16 | Mainline: "master", 17 | }, fakePullRequestResponse(2), ch) 18 | ch <- &github.PushEvent{ 19 | Ref: stringVal("refs/heads/master"), 20 | Repo: &github.PushEventRepository{ 21 | Name: stringVal("test"), 22 | Owner: &github.PushEventRepoOwner{ 23 | Name: stringVal("test"), 24 | }, 25 | }, 26 | } 27 | 28 | close(ch) 29 | 30 | if _, ok := <-out; !ok { 31 | t.Fatal("Expected output on PR, but didn't receive") 32 | } 33 | if _, ok := <-out; !ok { 34 | t.Fatal("Expected output on PR, but didn't receive") 35 | } 36 | }) 37 | } 38 | -------------------------------------------------------------------------------- /processors/status_event.go: -------------------------------------------------------------------------------- 1 | package processors 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/google/go-github/github" 7 | ) 8 | 9 | // StatusEvent emits pull requests when activity occurs on the specific branch 10 | func StatusEvent(client PullRequestLister, input <-chan *github.StatusEvent) <-chan *github.PullRequest { 11 | ret := make(chan *github.PullRequest) 12 | 13 | go func() { 14 | for evt := range input { 15 | if evt.GetState() != "success" { 16 | continue 17 | } 18 | 19 | prs, _, err := client.List( 20 | context.Background(), 21 | evt.Repo.Owner.GetLogin(), 22 | evt.Repo.GetName(), 23 | &github.PullRequestListOptions{ 24 | State: "open", 25 | }) 26 | if err != nil { 27 | continue 28 | } 29 | 30 | var pr *github.PullRequest 31 | for _, branch := range evt.Branches { 32 | for _, p := range prs { 33 | if *p.Head.Ref == *branch.Name { 34 | pr = p 35 | break 36 | } 37 | } 38 | 39 | if pr != nil { 40 | break 41 | } 42 | } 43 | 44 | if pr == nil { 45 | continue 46 | } 47 | ret <- pr 48 | } 49 | close(ret) 50 | }() 51 | 52 | return ret 53 | } 54 | -------------------------------------------------------------------------------- /processors/types.go: -------------------------------------------------------------------------------- 1 | package processors 2 | 3 | type Repository struct { 4 | Owner string 5 | Name string 6 | Mainline string 7 | Cache WorkerCache 8 | } 9 | -------------------------------------------------------------------------------- /repo/internal/cmd/cmd.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | "os/exec" 7 | ) 8 | 9 | // MustConfigure re-configures a command dynamically. 10 | // If the reconfiguration fails it's expected to crash the program 11 | func MustConfigure(cmd *exec.Cmd, fn func(*exec.Cmd)) *exec.Cmd { 12 | fn(cmd) 13 | return cmd 14 | } 15 | 16 | // Pipeline is a collection of exec.Cmd to execute in serial 17 | type Pipeline []*exec.Cmd 18 | 19 | // Run executes all commands in a pipeline and returns the first error it encounters or nil 20 | func (p Pipeline) Run() (string, string, error) { 21 | var stdout bytes.Buffer 22 | var stderr bytes.Buffer 23 | for _, cmd := range p { 24 | cmd.Stdout = &stdout 25 | cmd.Stderr = &stderr 26 | stdout.WriteString(fmt.Sprintf("Executing %s\n", cmd.Args)) 27 | if err := cmd.Run(); err != nil { 28 | return stdout.String(), stderr.String(), err 29 | } 30 | } 31 | return stdout.String(), stderr.String(), nil 32 | } 33 | -------------------------------------------------------------------------------- /repo/internal/log/log.go: -------------------------------------------------------------------------------- 1 | package log 2 | 3 | import ( 4 | "bufio" 5 | "io" 6 | stdLog "log" 7 | "strings" 8 | ) 9 | 10 | func Printf(format string, a ...interface{}) { 11 | stdLog.Printf(format, a...) 12 | } 13 | 14 | func Fatalf(format string, a ...interface{}) { 15 | stdLog.Fatalf(format, a...) 16 | } 17 | 18 | func PrintLinesPrefixed(prefix, lines string) { 19 | r := bufio.NewReader(strings.NewReader(lines)) 20 | for { 21 | line, err := r.ReadString('\n') 22 | if err != nil { 23 | if err == io.EOF { 24 | Printf("%s %s", prefix, string(line)) 25 | } 26 | break 27 | } 28 | Printf("%s %s", prefix, string(line)) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /repo/signal.go: -------------------------------------------------------------------------------- 1 | package repo 2 | 3 | type Signal struct { 4 | Error error 5 | UpToDate bool 6 | } 7 | -------------------------------------------------------------------------------- /scenarios/rebase-conflict.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolai86/github-rebase-bot/f10b592c540664fcfc3d2f2b1fa06d6c34b40c84/scenarios/rebase-conflict.zip -------------------------------------------------------------------------------- /startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | function get_public_dns() { 4 | curl -s -ik -H "Authorization: Bearer $(cat /var/run/secrets/kubernetes.io/serviceaccount/token)" https://kubernetes.default.svc.cluster.local/api/v1/namespaces/github/services/rebase-bot | grep "ip" | awk '{print $2}' | awk -F'"' '{print $2}' 5 | } 6 | 7 | # only determine k8s IP if not set explicitly 8 | if [[ "z$PUBLIC_DNS" == "z" ]]; then 9 | PUBLIC_DNS=$(get_public_dns) 10 | while [[ "z$PUBLIC_DNS" == "z" ]]; do 11 | echo "Waiting for service to come up" 12 | sleep 2 13 | PUBLIC_DNS=$(get_public_dns) 14 | done 15 | fi 16 | 17 | /github-rebase-bot \ 18 | -repos "$GITHUB_REPOS" \ 19 | -public-dns http://$PUBLIC_DNS \ 20 | -merge-label "$GITHUB_MERGE_LABEL" \ 21 | -addr :8080 22 | -------------------------------------------------------------------------------- /vendor/github.com/golang/protobuf/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.[568ao] 3 | *.ao 4 | *.so 5 | *.pyc 6 | ._* 7 | .nfs.* 8 | [568a].out 9 | *~ 10 | *.orig 11 | core 12 | _obj 13 | _test 14 | _testmain.go 15 | protoc-gen-go/testdata/multi/*.pb.go 16 | _conformance/_conformance 17 | -------------------------------------------------------------------------------- /vendor/github.com/golang/protobuf/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: go 3 | go: 4 | - 1.6.x 5 | - 1.7.x 6 | - 1.8.x 7 | 8 | install: 9 | - go get -v -d -t github.com/golang/protobuf/... 10 | - curl -L https://github.com/google/protobuf/releases/download/v3.3.0/protoc-3.3.0-linux-x86_64.zip -o /tmp/protoc.zip 11 | - unzip /tmp/protoc.zip -d $HOME/protoc 12 | 13 | env: 14 | - PATH=$HOME/protoc/bin:$PATH 15 | 16 | script: 17 | - make all test 18 | -------------------------------------------------------------------------------- /vendor/github.com/golang/protobuf/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/github.com/golang/protobuf/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/github.com/golang/protobuf/descriptor/descriptor_test.go: -------------------------------------------------------------------------------- 1 | package descriptor_test 2 | 3 | import ( 4 | "fmt" 5 | "testing" 6 | 7 | "github.com/golang/protobuf/descriptor" 8 | tpb "github.com/golang/protobuf/proto/testdata" 9 | protobuf "github.com/golang/protobuf/protoc-gen-go/descriptor" 10 | ) 11 | 12 | func TestMessage(t *testing.T) { 13 | var msg *protobuf.DescriptorProto 14 | fd, md := descriptor.ForMessage(msg) 15 | if pkg, want := fd.GetPackage(), "google.protobuf"; pkg != want { 16 | t.Errorf("descriptor.ForMessage(%T).GetPackage() = %q; want %q", msg, pkg, want) 17 | } 18 | if name, want := md.GetName(), "DescriptorProto"; name != want { 19 | t.Fatalf("descriptor.ForMessage(%T).GetName() = %q; want %q", msg, name, want) 20 | } 21 | } 22 | 23 | func Example_Options() { 24 | var msg *tpb.MyMessageSet 25 | _, md := descriptor.ForMessage(msg) 26 | if md.GetOptions().GetMessageSetWireFormat() { 27 | fmt.Printf("%v uses option message_set_wire_format.\n", md.GetName()) 28 | } 29 | 30 | // Output: 31 | // MyMessageSet uses option message_set_wire_format. 32 | } 33 | -------------------------------------------------------------------------------- /vendor/github.com/golang/protobuf/proto/map_test.go: -------------------------------------------------------------------------------- 1 | package proto_test 2 | 3 | import ( 4 | "fmt" 5 | "testing" 6 | 7 | "github.com/golang/protobuf/proto" 8 | ppb "github.com/golang/protobuf/proto/proto3_proto" 9 | ) 10 | 11 | func marshalled() []byte { 12 | m := &ppb.IntMaps{} 13 | for i := 0; i < 1000; i++ { 14 | m.Maps = append(m.Maps, &ppb.IntMap{ 15 | Rtt: map[int32]int32{1: 2}, 16 | }) 17 | } 18 | b, err := proto.Marshal(m) 19 | if err != nil { 20 | panic(fmt.Sprintf("Can't marshal %+v: %v", m, err)) 21 | } 22 | return b 23 | } 24 | 25 | func BenchmarkConcurrentMapUnmarshal(b *testing.B) { 26 | in := marshalled() 27 | b.RunParallel(func(pb *testing.PB) { 28 | for pb.Next() { 29 | var out ppb.IntMaps 30 | if err := proto.Unmarshal(in, &out); err != nil { 31 | b.Errorf("Can't unmarshal ppb.IntMaps: %v", err) 32 | } 33 | } 34 | }) 35 | } 36 | 37 | func BenchmarkSequentialMapUnmarshal(b *testing.B) { 38 | in := marshalled() 39 | b.ResetTimer() 40 | for i := 0; i < b.N; i++ { 41 | var out ppb.IntMaps 42 | if err := proto.Unmarshal(in, &out); err != nil { 43 | b.Errorf("Can't unmarshal ppb.IntMaps: %v", err) 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /vendor/github.com/google/go-github/.gitignore: -------------------------------------------------------------------------------- 1 | *.test 2 | -------------------------------------------------------------------------------- /vendor/github.com/google/go-github/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: go 3 | go: 4 | - 1.7.x 5 | - 1.8.x 6 | - master 7 | matrix: 8 | allow_failures: 9 | - go: master 10 | fast_finish: true 11 | install: 12 | - # Do nothing. This is needed to prevent default install action "go get -t -v ./..." from happening here (we want it to happen inside script step). 13 | script: 14 | - go get -t -v ./... 15 | - diff -u <(echo -n) <(gofmt -d -s .) 16 | - go generate -x ./... && git diff --exit-code; code=$?; git checkout -- .; (exit $code) # Check that go generate ./... produces a zero diff; clean up any changes afterwards. 17 | - go tool vet . 18 | - go test -v -race ./... 19 | -------------------------------------------------------------------------------- /vendor/github.com/google/go-github/github/apps_installation_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The go-github AUTHORS. All rights reserved. 2 | // 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | package github 7 | 8 | import ( 9 | "context" 10 | "fmt" 11 | "net/http" 12 | "reflect" 13 | "testing" 14 | ) 15 | 16 | func TestAppsService_ListRepos(t *testing.T) { 17 | setup() 18 | defer teardown() 19 | 20 | mux.HandleFunc("/installation/repositories", func(w http.ResponseWriter, r *http.Request) { 21 | testMethod(t, r, "GET") 22 | testHeader(t, r, "Accept", mediaTypeIntegrationPreview) 23 | testFormValues(t, r, values{ 24 | "page": "1", 25 | "per_page": "2", 26 | }) 27 | fmt.Fprint(w, `{"repositories": [{"id":1}]}`) 28 | }) 29 | 30 | opt := &ListOptions{Page: 1, PerPage: 2} 31 | repositories, _, err := client.Apps.ListRepos(context.Background(), opt) 32 | if err != nil { 33 | t.Errorf("Apps.ListRepos returned error: %v", err) 34 | } 35 | 36 | want := []*Repository{{ID: Int(1)}} 37 | if !reflect.DeepEqual(repositories, want) { 38 | t.Errorf("Apps.ListRepos returned %+v, want %+v", repositories, want) 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /vendor/github.com/google/go-github/github/apps_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The go-github AUTHORS. All rights reserved. 2 | // 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | package github 7 | 8 | import ( 9 | "context" 10 | "fmt" 11 | "net/http" 12 | "reflect" 13 | "testing" 14 | ) 15 | 16 | func TestAppsService_ListInstallations(t *testing.T) { 17 | setup() 18 | defer teardown() 19 | 20 | mux.HandleFunc("/app/installations", func(w http.ResponseWriter, r *http.Request) { 21 | testMethod(t, r, "GET") 22 | testHeader(t, r, "Accept", mediaTypeIntegrationPreview) 23 | testFormValues(t, r, values{ 24 | "page": "1", 25 | "per_page": "2", 26 | }) 27 | fmt.Fprint(w, `[{"id":1}]`) 28 | }) 29 | 30 | opt := &ListOptions{Page: 1, PerPage: 2} 31 | installations, _, err := client.Apps.ListInstallations(context.Background(), opt) 32 | if err != nil { 33 | t.Errorf("Apps.ListInstallations returned error: %v", err) 34 | } 35 | 36 | want := []*Installation{{ID: Int(1)}} 37 | if !reflect.DeepEqual(installations, want) { 38 | t.Errorf("Apps.ListInstallations returned %+v, want %+v", installations, want) 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /vendor/github.com/google/go-github/github/git.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The go-github AUTHORS. All rights reserved. 2 | // 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | package github 7 | 8 | // GitService handles communication with the git data related 9 | // methods of the GitHub API. 10 | // 11 | // GitHub API docs: https://developer.github.com/v3/git/ 12 | type GitService service 13 | -------------------------------------------------------------------------------- /vendor/github.com/google/go-github/github/issues_timeline_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The go-github AUTHORS. All rights reserved. 2 | // 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | package github 7 | 8 | import ( 9 | "context" 10 | "fmt" 11 | "net/http" 12 | "reflect" 13 | "testing" 14 | ) 15 | 16 | func TestIssuesService_ListIssueTimeline(t *testing.T) { 17 | setup() 18 | defer teardown() 19 | 20 | mux.HandleFunc("/repos/o/r/issues/1/timeline", func(w http.ResponseWriter, r *http.Request) { 21 | testMethod(t, r, "GET") 22 | testHeader(t, r, "Accept", mediaTypeTimelinePreview) 23 | testFormValues(t, r, values{ 24 | "page": "1", 25 | "per_page": "2", 26 | }) 27 | fmt.Fprint(w, `[{"id":1}]`) 28 | }) 29 | 30 | opt := &ListOptions{Page: 1, PerPage: 2} 31 | events, _, err := client.Issues.ListIssueTimeline(context.Background(), "o", "r", 1, opt) 32 | if err != nil { 33 | t.Errorf("Issues.ListIssueTimeline returned error: %v", err) 34 | } 35 | 36 | want := []*Timeline{{ID: Int(1)}} 37 | if !reflect.DeepEqual(events, want) { 38 | t.Errorf("Issues.ListIssueTimeline = %+v, want %+v", events, want) 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /vendor/github.com/google/go-github/github/with_appengine.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The go-github AUTHORS. All rights reserved. 2 | // 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | // +build appengine 7 | 8 | // This file provides glue for making github work on App Engine. 9 | // In order to get the entire github package to compile with 10 | // Go 1.6, you will need to rewrite all the import "context" lines. 11 | // Fortunately, this is easy with "gofmt": 12 | // 13 | // gofmt -w -r '"context" -> "golang.org/x/net/context"' *.go 14 | 15 | package github 16 | 17 | import ( 18 | "context" 19 | "net/http" 20 | 21 | "google.golang.org/appengine" 22 | ) 23 | 24 | func withContext(ctx context.Context, req *http.Request) (context.Context, *http.Request) { 25 | return appengine.WithContext(ctx, req), req 26 | } 27 | -------------------------------------------------------------------------------- /vendor/github.com/google/go-github/github/without_appengine.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The go-github AUTHORS. All rights reserved. 2 | // 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | // +build !appengine 7 | 8 | // This file provides glue for making github work without App Engine. 9 | 10 | package github 11 | 12 | import ( 13 | "context" 14 | "net/http" 15 | ) 16 | 17 | func withContext(ctx context.Context, req *http.Request) (context.Context, *http.Request) { 18 | return ctx, req.WithContext(ctx) 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/google/go-github/tests/integration/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The go-github AUTHORS. All rights reserved. 2 | // 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | // Package tests contains integration tests. 7 | // 8 | // These tests call the live GitHub API, and therefore require a little more 9 | // setup to run. See https://github.com/google/go-github/tree/master/tests#integration 10 | // for more information. 11 | package tests 12 | -------------------------------------------------------------------------------- /vendor/github.com/google/go-github/tests/integration/issues_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The go-github AUTHORS. All rights reserved. 2 | // 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | // +build integration 7 | 8 | package tests 9 | 10 | import "testing" 11 | 12 | func TestIssueEvents(t *testing.T) { 13 | events, _, err := client.Issues.ListRepositoryEvents("google", "go-github", nil) 14 | if err != nil { 15 | t.Fatalf("Issues.ListRepositoryEvents returned error: %v", err) 16 | } 17 | 18 | if len(events) == 0 { 19 | t.Errorf("ListRepositoryEvents returned no events") 20 | } 21 | 22 | events, _, err = client.Issues.ListIssueEvents("google", "go-github", 1, nil) 23 | if err != nil { 24 | t.Fatalf("Issues.ListIssueEvents returned error: %v", err) 25 | } 26 | 27 | if len(events) == 0 { 28 | t.Errorf("ListIssueEvents returned no events") 29 | } 30 | 31 | event, _, err := client.Issues.GetEvent("google", "go-github", *events[0].ID) 32 | if err != nil { 33 | t.Fatalf("Issues.GetEvent returned error: %v", err) 34 | } 35 | 36 | if *event.URL != *events[0].URL { 37 | t.Fatalf("Issues.GetEvent returned event URL: %v, want %v", *event.URL, *events[0].URL) 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /vendor/github.com/google/go-github/tests/integration/pulls_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The go-github AUTHORS. All rights reserved. 2 | // 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | // +build integration 7 | 8 | package tests 9 | 10 | import "testing" 11 | 12 | func TestPullRequests_ListCommits(t *testing.T) { 13 | commits, _, err := client.PullRequests.ListCommits("google", "go-github", 2, nil) 14 | if err != nil { 15 | t.Fatalf("PullRequests.ListCommits() returned error: %v", err) 16 | } 17 | 18 | if got, want := len(commits), 3; got != want { 19 | t.Fatalf("PullRequests.ListCommits() returned %d commits, want %d", got, want) 20 | } 21 | 22 | if got, want := *commits[0].Author.Login, "sqs"; got != want { 23 | t.Fatalf("PullRequests.ListCommits()[0].Author.Login returned %v, want %v", got, want) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/google/go-querystring/.gitignore: -------------------------------------------------------------------------------- 1 | *.test 2 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/.gitattributes: -------------------------------------------------------------------------------- 1 | # Treat all files in this repo as binary, with no git magic updating 2 | # line endings. Windows users contributing to Go will need to use a 3 | # modern version of git and editors capable of LF line endings. 4 | # 5 | # We'll prevent accidental CRLF line endings from entering the repo 6 | # via the git-review gofmt checks. 7 | # 8 | # See golang.org/issue/9281 9 | 10 | * -text 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/.gitignore: -------------------------------------------------------------------------------- 1 | # Add no patterns to .hgignore except for files generated by the build. 2 | last-change 3 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Go 2 | 3 | Go is an open source project. 4 | 5 | It is the work of hundreds of contributors. We appreciate your help! 6 | 7 | 8 | ## Filing issues 9 | 10 | When [filing an issue](https://golang.org/issue/new), make sure to answer these five questions: 11 | 12 | 1. What version of Go are you using (`go version`)? 13 | 2. What operating system and processor architecture are you using? 14 | 3. What did you do? 15 | 4. What did you expect to see? 16 | 5. What did you see instead? 17 | 18 | General questions should go to the [golang-nuts mailing list](https://groups.google.com/group/golang-nuts) instead of the issue tracker. 19 | The gophers there will answer or ask you to file an issue if you've tripped over a bug. 20 | 21 | ## Contributing code 22 | 23 | Please read the [Contribution Guidelines](https://golang.org/doc/contribute.html) 24 | before sending patches. 25 | 26 | **We do not accept GitHub pull requests** 27 | (we use [Gerrit](https://code.google.com/p/gerrit/) instead for code review). 28 | 29 | Unless otherwise noted, the Go source files are distributed under 30 | the BSD-style license found in the LICENSE file. 31 | 32 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/README: -------------------------------------------------------------------------------- 1 | This repository holds supplementary Go networking libraries. 2 | 3 | To submit changes to this repository, see http://golang.org/doc/contribute.html. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/bpf/setter.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package bpf 6 | 7 | // A Setter is a type which can attach a compiled BPF filter to itself. 8 | type Setter interface { 9 | SetBPF(filter []RawInstruction) error 10 | } 11 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/bpf/testdata/all_instructions.bpf: -------------------------------------------------------------------------------- 1 | 50,0 0 0 42,1 0 0 42,96 0 0 3,97 0 0 3,48 0 0 42,40 0 0 42,32 0 0 42,80 0 0 42,72 0 0 42,64 0 0 42,177 0 0 42,128 0 0 0,32 0 0 4294963200,32 0 0 4294963204,32 0 0 4294963256,2 0 0 3,3 0 0 3,4 0 0 42,20 0 0 42,36 0 0 42,52 0 0 42,68 0 0 42,84 0 0 42,100 0 0 42,116 0 0 42,148 0 0 42,164 0 0 42,12 0 0 0,28 0 0 0,44 0 0 0,60 0 0 0,76 0 0 0,92 0 0 0,108 0 0 0,124 0 0 0,156 0 0 0,172 0 0 0,132 0 0 0,5 0 0 10,21 8 9 42,21 0 8 42,53 0 7 42,37 0 6 42,37 4 5 42,53 3 4 42,69 2 3 42,7 0 0 0,135 0 0 0,22 0 0 0,6 0 0 0, 2 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/bpf/testdata/all_instructions.txt: -------------------------------------------------------------------------------- 1 | # This filter is compiled to all_instructions.bpf by the `bpf_asm` 2 | # tool, which can be found in the linux kernel source tree under 3 | # tools/net. 4 | 5 | # Load immediate 6 | ld #42 7 | ldx #42 8 | 9 | # Load scratch 10 | ld M[3] 11 | ldx M[3] 12 | 13 | # Load absolute 14 | ldb [42] 15 | ldh [42] 16 | ld [42] 17 | 18 | # Load indirect 19 | ldb [x + 42] 20 | ldh [x + 42] 21 | ld [x + 42] 22 | 23 | # Load IPv4 header length 24 | ldx 4*([42]&0xf) 25 | 26 | # Run extension function 27 | ld #len 28 | ld #proto 29 | ld #type 30 | ld #rand 31 | 32 | # Store scratch 33 | st M[3] 34 | stx M[3] 35 | 36 | # A constant 37 | add #42 38 | sub #42 39 | mul #42 40 | div #42 41 | or #42 42 | and #42 43 | lsh #42 44 | rsh #42 45 | mod #42 46 | xor #42 47 | 48 | # A X 49 | add x 50 | sub x 51 | mul x 52 | div x 53 | or x 54 | and x 55 | lsh x 56 | rsh x 57 | mod x 58 | xor x 59 | 60 | # !A 61 | neg 62 | 63 | # Jumps 64 | ja end 65 | jeq #42,prev,end 66 | jne #42,end 67 | jlt #42,end 68 | jle #42,end 69 | jgt #42,prev,end 70 | jge #42,prev,end 71 | jset #42,prev,end 72 | 73 | # Register transfers 74 | tax 75 | txa 76 | 77 | # Returns 78 | prev: ret a 79 | end: ret #42 80 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/codereview.cfg: -------------------------------------------------------------------------------- 1 | issuerepo: golang/go 2 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/context/ctxhttp/ctxhttp_17_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !plan9,go1.7 6 | 7 | package ctxhttp 8 | 9 | import ( 10 | "io" 11 | "net/http" 12 | "net/http/httptest" 13 | "testing" 14 | 15 | "context" 16 | ) 17 | 18 | func TestGo17Context(t *testing.T) { 19 | ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 20 | io.WriteString(w, "ok") 21 | })) 22 | defer ts.Close() 23 | ctx := context.Background() 24 | resp, err := Get(ctx, http.DefaultClient, ts.URL) 25 | if resp == nil || err != nil { 26 | t.Fatalf("error received from client: %v %v", err, resp) 27 | } 28 | resp.Body.Close() 29 | } 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/context/withtimeout_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package context_test 6 | 7 | import ( 8 | "fmt" 9 | "time" 10 | 11 | "golang.org/x/net/context" 12 | ) 13 | 14 | // This example passes a context with a timeout to tell a blocking function that 15 | // it should abandon its work after the timeout elapses. 16 | func ExampleWithTimeout() { 17 | // Pass a context with a timeout to tell a blocking function that it 18 | // should abandon its work after the timeout elapses. 19 | ctx, cancel := context.WithTimeout(context.Background(), 50*time.Millisecond) 20 | defer cancel() 21 | 22 | select { 23 | case <-time.After(1 * time.Second): 24 | fmt.Println("overslept") 25 | case <-ctx.Done(): 26 | fmt.Println(ctx.Err()) // prints "context deadline exceeded" 27 | } 28 | 29 | // Output: 30 | // context deadline exceeded 31 | } 32 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/html/charset/testdata/README: -------------------------------------------------------------------------------- 1 | These test cases come from 2 | http://www.w3.org/International/tests/repository/html5/the-input-byte-stream/results-basics 3 | 4 | Distributed under both the W3C Test Suite License 5 | (http://www.w3.org/Consortium/Legal/2008/04-testsuite-license) 6 | and the W3C 3-clause BSD License 7 | (http://www.w3.org/Consortium/Legal/2008/03-bsd-license). 8 | To contribute to a W3C Test Suite, see the policies and contribution 9 | forms (http://www.w3.org/2004/10/27-testcases). 10 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/html/charset/testdata/UTF-16BE-BOM.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolai86/github-rebase-bot/f10b592c540664fcfc3d2f2b1fa06d6c34b40c84/vendor/golang.org/x/net/html/charset/testdata/UTF-16BE-BOM.html -------------------------------------------------------------------------------- /vendor/golang.org/x/net/html/charset/testdata/UTF-16LE-BOM.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolai86/github-rebase-bot/f10b592c540664fcfc3d2f2b1fa06d6c34b40c84/vendor/golang.org/x/net/html/charset/testdata/UTF-16LE-BOM.html -------------------------------------------------------------------------------- /vendor/golang.org/x/net/html/entity_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package html 6 | 7 | import ( 8 | "testing" 9 | "unicode/utf8" 10 | ) 11 | 12 | func TestEntityLength(t *testing.T) { 13 | // We verify that the length of UTF-8 encoding of each value is <= 1 + len(key). 14 | // The +1 comes from the leading "&". This property implies that the length of 15 | // unescaped text is <= the length of escaped text. 16 | for k, v := range entity { 17 | if 1+len(k) < utf8.RuneLen(v) { 18 | t.Error("escaped entity &" + k + " is shorter than its UTF-8 encoding " + string(v)) 19 | } 20 | if len(k) > longestEntityWithoutSemicolon && k[len(k)-1] != ';' { 21 | t.Errorf("entity name %s is %d characters, but longestEntityWithoutSemicolon=%d", k, len(k), longestEntityWithoutSemicolon) 22 | } 23 | } 24 | for k, v := range entity2 { 25 | if 1+len(k) < utf8.RuneLen(v[0])+utf8.RuneLen(v[1]) { 26 | t.Error("escaped entity &" + k + " is shorter than its UTF-8 encoding " + string(v[0]) + string(v[1])) 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/html/example_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // This example demonstrates parsing HTML data and walking the resulting tree. 6 | package html_test 7 | 8 | import ( 9 | "fmt" 10 | "log" 11 | "strings" 12 | 13 | "golang.org/x/net/html" 14 | ) 15 | 16 | func ExampleParse() { 17 | s := `

Links:

` 18 | doc, err := html.Parse(strings.NewReader(s)) 19 | if err != nil { 20 | log.Fatal(err) 21 | } 22 | var f func(*html.Node) 23 | f = func(n *html.Node) { 24 | if n.Type == html.ElementNode && n.Data == "a" { 25 | for _, a := range n.Attr { 26 | if a.Key == "href" { 27 | fmt.Println(a.Val) 28 | break 29 | } 30 | } 31 | } 32 | for c := n.FirstChild; c != nil; c = c.NextSibling { 33 | f(c) 34 | } 35 | } 36 | f(doc) 37 | // Output: 38 | // foo 39 | // /bar/baz 40 | } 41 | -------------------------------------------------------------------------------- /vendor/golang.org/x/net/html/testdata/webkit/adoption02.dat: -------------------------------------------------------------------------------- 1 | #data 2 | 12

34 3 | #errors 4 | #document 5 | | 6 | | 7 | | 8 | | 9 | | "1" 10 | | 11 | | "2" 12 | | 13 | |

14 | | 15 | | "3" 16 | | "4" 17 | 18 | #data 19 |

20 | #errors 21 | #document 22 | | 23 | | 24 | | 25 | | 26 | |
27 | | 28 | |